Skip to content

Commit

Permalink
Merge pull request #34 from psibi/cargo-lock
Browse files Browse the repository at this point in the history
Update cargo lock file
  • Loading branch information
psibi authored Feb 8, 2023
2 parents 3d560c2 + f128c0b commit bb263f6
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 22 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- windows-latest

toolchain:
- 1.64.0
- 1.67.0
- stable
- nightly

Expand Down Expand Up @@ -58,13 +58,13 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.64.0
toolchain: 1.67.0
target: x86_64-unknown-linux-musl
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.64.0-binary
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.67.0-binary
- name: Install musl tools
run: sudo apt-get install -y musl-tools
- name: Build
Expand Down Expand Up @@ -93,12 +93,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.64.0
toolchain: 1.67.0
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.64.0-binary
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.67.0-binary
- name: Build
run: cargo build --release
- name: Rename
Expand All @@ -123,12 +123,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.64.0
toolchain: 1.67.0
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.64.0-binary
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.67.0-binary
- name: Build
run: cargo build --release
- name: Rename
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change log for Amber

## 0.1.5 (2022-12-23)

* Update rust toolchain to 1.67.0
* Fix cargo lock file issue causing packaging problem.

## 0.1.4 (2022-11-29)

* Upgrade to clap v4
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "amber"
version = "0.1.4"
version = "0.1.5"
authors = ["Michael Snoyman <[email protected]>"]
edition = "2018"
description = "Manage secret values in-repo via public key cryptography"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.64.0"
channel = "1.67.0"
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static VERSION_SHA: Lazy<String> = Lazy::new(|| {
let pkgver = env!("CARGO_PKG_VERSION");
match option_env!("VERGEN_GIT_SHA") {
None => pkgver.to_owned(),
Some(gitsha) => format!("{} (Git SHA1 {})", pkgver, gitsha),
Some(gitsha) => format!("{pkgver} (Git SHA1 {gitsha})"),
}
});

Expand Down Expand Up @@ -139,7 +139,7 @@ impl Opt {
}
self.amber_yaml
.as_deref()
.with_context(|| format!("No file named {} found", DEFAULT_AMBER_YAML))
.with_context(|| format!("No file named {DEFAULT_AMBER_YAML} found"))
}

pub fn find_amber_yaml_or_default(&mut self) -> &Path {
Expand Down
9 changes: 3 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,7 @@ impl Config {
Ok(secret)
})()
.with_context(|| {
format!(
"Error loading secret key from environment variable {}",
SECRET_KEY_ENV
)
format!("Error loading secret key from environment variable {SECRET_KEY_ENV}")
})
}

Expand All @@ -215,7 +212,7 @@ impl Config {
pub(crate) fn get_secret(&self, key: &str, secret_key: &SecretKey) -> Result<String> {
self.secrets
.get(key)
.with_context(|| format!("Key does not exist: {}", key))
.with_context(|| format!("Key does not exist: {key}"))
.and_then(|secret| secret.decrypt(secret_key, key))
}
}
Expand Down Expand Up @@ -254,6 +251,6 @@ impl Secret {
);
String::from_utf8(plain.to_vec()).context("Invalid UTF-8 encoding")
})()
.with_context(|| format!("Error while decrypting secret named {}", key))
.with_context(|| format!("Error while decrypting secret named {key}"))
}
}
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ fn init(mut opt: cli::Opt, only_secret_key: bool) -> Result<()> {
config.save(opt.find_amber_yaml_or_default())?;

if only_secret_key {
print!("{}", secret_key);
print!("{secret_key}");
} else {
eprintln!("Your secret key is: {}", secret_key);
eprintln!("Your secret key is: {secret_key}");
eprintln!(
"Please save this key immediately! If you lose it, you will lose access to your secrets."
);
Expand Down Expand Up @@ -104,7 +104,7 @@ fn encrypt(mut opt: cli::Opt, key: String, value: Option<String>) -> Result<()>
fn generate(opt: cli::Opt, key: String) -> Result<()> {
let value = SecretKey::generate(&mut OsRng);
let value = encode_config(value.as_bytes(), base64::URL_SAFE);
let msg = format!("Your new secret value is {}: {}", key, value);
let msg = format!("Your new secret value is {key}: {value}");
encrypt(opt, key, Some(value))?;
println!("{}", &msg);
Ok(())
Expand Down Expand Up @@ -136,7 +136,7 @@ fn print(mut opt: cli::Opt, style: cli::PrintStyle) -> Result<()> {
match style {
cli::PrintStyle::SetEnv => pairs
.iter()
.for_each(|(key, value)| println!("export {}={:?}", key, value)),
.for_each(|(key, value)| println!("export {key}={value:?}")),
cli::PrintStyle::Json => {
let secrets = to_objs(&pairs);
serde_json::to_writer(std::io::stdout(), &secrets)?;
Expand Down

0 comments on commit bb263f6

Please sign in to comment.