Skip to content

Commit a9fd162

Browse files
authored
Merge pull request #138 from cloudsmith-io/staging
Staging
2 parents 1760db0 + b68be1f commit a9fd162

File tree

6 files changed

+171
-97
lines changed

6 files changed

+171
-97
lines changed

src/content/formats/cargo-registry.mdx

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Note, Video } from '@/components';
1+
import { Note, Video, BlockImage } from '@/components';
22

33
# Cargo Registry
44

5-
Cloudsmith provides public & private registries for Cargo (Rust)
5+
Cloudsmith provides public & private registries for Cargo (Rust).
66

77
<Video wistiaId="6j1x45h87p"></Video>
88

@@ -12,8 +12,6 @@ For more information on Rust, please see:
1212
- [Cargo](https://doc.rust-lang.org/cargo/index.html): The official documentation for Cargo - the Rust package manager
1313
- [Crates Public Registry](https://crates.io/): The official Rust community's crate registry
1414

15-
16-
1715
<Note variant="note" headline="Contextual Documentation">
1816
The examples in this document are generic. Cloudsmith provides contextual setup instructions within each repository, complete with copy and paste snippets (with your namespace/repo/rsa-key pre-configured).
1917
</Note>
@@ -57,26 +55,34 @@ The setup method will differ depending on what authentication type you choose to
5755
Entitlement Tokens, User Credentials and API-Keys should be treated as secrets, and you should ensure that you do not commit them in configurations files along with source code, or expose them in any logs.
5856
</Note>
5957

60-
```text Entitlement Token Auth
58+
```toml
59+
# Entitlement Token Auth
6160
[registries]
6261
REGISTRY_NAME = { index = "https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cargo/index.git" }
6362
```
64-
```toml HTTP Basic Auth
63+
64+
```toml
65+
# HTTP Basic Auth
6566
[registries]
6667
REGISTRY_NAME = { index = "https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cargo/index.git" }
6768
```
6869

6970
If using HTTP basic authentication, you'll need to configure Git with credentials. Git's standard authentication mechanisms are used by Cargo and can be configured in the normal way. For example, you could use git's per-user credential store as follows:
7071

71-
```shell HTTP Basic Auth (User & Pass)
72+
```shell
73+
# HTTP Basic Auth (User & Pass)
7274
git config --global credential.helper store
7375
echo "https://USERNAME:[email protected]" > ~/.git-credentials
7476
```
75-
```shell HTTP Basic Auth (API-Key)
77+
78+
```shell
79+
# HTTP Basic Auth (API-Key)
7680
git config --global credential.helper store
7781
echo "https://USERNAME:[email protected]" > ~/.git-credentials
7882
```
79-
```shell HTTP Basic Auth (Token)
83+
84+
```shell
85+
# HTTP Basic Auth (Token)
8086
git config --global credential.helper store
8187
echo "https://token:[email protected]" > ~/.git-credentials
8288
```
@@ -106,9 +112,11 @@ cargo publish --registry REGISTRY_NAME
106112

107113
If you haven't specified credentials using one of the methods above, you'll be asked to provide them using `cargo login`.
108114

109-
You can also set the following environment variables:
110-
`CARGO_REGISTRIES_<REGISTRY_NAME>_INDEX` - instead of setting the registry URL in `~/.cargo/config`
111-
`CARGO_REGISTRIES_<REGISTRY_NAME>_TOKEN` - instead of providing credentials via `cargo login` or writing them to `~/.cargo/credentials`:
115+
Instead of usign the previous authentication methods, you can also set the following environment variables to define your index and token:
116+
- `CARGO_REGISTRIES_<REGISTRY_NAME>_INDEX`
117+
- `CARGO_REGISTRIES_<REGISTRY_NAME>_TOKEN`
118+
119+
Remember to rename the variable with your registry name.
112120

113121
### Upload via the Cloudsmith CLI
114122

@@ -132,6 +140,14 @@ Please see [Upload a Package](/artifact-management/package-upload) for details o
132140

133141
## Download a Package
134142

143+
### Configure a new Upstream
144+
145+
Cloudsmith supports [https://index.crates.io](https://index.crates.io) as an upstream. This allows you to proxy and cache external Rust crates that are not part of your repository.
146+
147+
To enable the upstream, browse to your repository overview page and click in the Upstreams tab. Then, click on **+ Add Upstream Proxy** and then choose the **Cargo** Upstream.
148+
149+
In the Upstream creation menu, define a name your Upstream and in the **Proxy URL** field insert `https://index.crates.io/`. Click on **+ Create Upstream Proxy** and the upstream should become immediately available.
150+
135151
### Registry Setup
136152

137153
It is easy to add a Cloudsmith-based Cargo registry.
@@ -176,7 +192,7 @@ OWNER-REPOSITORY = { index = "https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/ca
176192
OWNER-REPOSITORY = { index = "https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cargo/index.git" }
177193
```
178194

179-
## Registry Authentication
195+
### Registry Authentication
180196

181197
You must configure Git with the proper credentials to clone the registry when using HTTP basic authentication. Git's standard authentication mechanisms are used by Cargo and can be configured normally. For example, you could use git's per-user credential store like so:
182198

@@ -207,20 +223,11 @@ cargo install PACKAGE_NAME --registry REGISTRY_NAME`
207223

208224
## Security Scanning
209225

210-
<span class="cs-tag cs-tag-dark-green">Supported</span>
211-
Please see our [Security Scanning](/policy-management/security-scanning) documentation for further information.
212-
213-
## Upstream Proxying / Caching
214-
215-
<span class="cs-tag cs-tag-dark-grey">Not Supported</span>
216-
217-
<Note variant="note" headline="Note">
218-
When you install a Cargo package, `cargo` will assume that all dependencies are available in your Cloudsmith repository. You can configure your Cloudsmith repository to fetch any dependencies from crates.io that are not already present. See the repository [Main Settings](/repositories/repository-settings) for further information.
219-
</Note>
226+
<span class="cs-tag cs-tag-dark-green">Supported.</span> Please see our [Security Scanning](/policy-management/security-scanning) documentation for further information.
220227

221228
## Key Signing Support
222229

223-
<span class="cs-tag cs-tag-dark-grey">Not Supported by Format</span>
230+
<span class="cs-tag cs-tag-dark-grey">Not Supported.</span>
224231

225232
## Troubleshooting
226233

492 KB
Loading
496 KB
Loading
495 KB
Loading
494 KB
Loading

0 commit comments

Comments
 (0)