cargo-credential-netrc

Crates.iocargo-credential-netrc
lib.rscargo-credential-netrc
version0.1.0
sourcesrc
created_at2024-10-07 20:07:51.640508
updated_at2024-10-07 20:07:51.640508
descriptionCargo credential provider that parses your .netrc file to get credentials.
homepagehttps://github.com/Nikita240/cargo-credential-netrc
repositoryhttps://github.com/Nikita240/cargo-credential-netrc
max_upload_size
id1400426
size24,842
Nikita Rushmanov (Nikita240)

documentation

README

cargo-credential-netrc

Cargo credential provider that parses your .netrc file to get credentials.

While this may not be the most secure or sophisticated way to manage your credentials, you may already be using .netrc files to handle your authentication for other tools. For such cases, this credential provider can be a useful drop in solution for authenticating with private cargo registries.

Usage

Different private cargo registry providers expect different things in the token. As a result, there is no way to generate the token from the .netrc file that will work for all cases. To address this, this credential provider REQUIRES you to specify the format of the token using the handlebars templating language with the --format argument.

The following variables are available:

  • login
  • account
  • password

NOTE: If your token format requires a space, you MUST use a credential alias to specify the token format.

Example

Here is an example of how to format a token for JFrog's Artifactory:

[credential-alias]
cargo-credential-artifactory = ["cargo-credential-netrc", "--format", "Bearer {{password}}"]

[registries.artifactory]
index = "sparse+<YOUR_ARTIFACTORY_URL>"
credential-provider = "cargo-credential-artifactory"
Commit count: 3

cargo fmt