Skip to content

Commit

Permalink
add migration for aws_config setting generator
Browse files Browse the repository at this point in the history
Add migration for the new aws_config setting generator.

Signed-off-by: Gavin Inglis <[email protected]>
  • Loading branch information
ginglis13 committed Oct 25, 2024
1 parent 91632ff commit 0c163e1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Release.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.26.1"
version = "1.27.0"

[migrations]
"(0.3.1, 0.3.2)" = ["migrate_v0.3.2_admin-container-v0-5-0.lz4"]
Expand Down Expand Up @@ -367,3 +367,6 @@ version = "1.26.1"
]
"(1.25.0, 1.26.0)" = []
"(1.26.0, 1.26.1)" = []
"(1.26.1, 1.27.0)" = [
"migrate_v1.27.0_aws-config.lz4",
]
7 changes: 7 additions & 0 deletions sources/Cargo.lock

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

1 change: 1 addition & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ members = [
"settings-migrations/v1.25.0/public-admin-container-v0-11-13",
"settings-migrations/v1.25.0/aws-control-container-v0-7-17",
"settings-migrations/v1.25.0/public-control-container-v0-7-17",
"settings-migrations/v1.27.0/aws-config",
"settings-plugins/aws-dev",
"settings-plugins/aws-ecs-1",
"settings-plugins/aws-ecs-2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "aws-config"
version = "0.1.0"
authors = ["Gavin Inglis <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false
# Don't rebuild crate just because of changes to README.
exclude = ["README.md"]


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
migration-helpers.workspace = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use migration_helpers::common_migrations::{AddMetadataMigration, SettingMetadata};
use migration_helpers::{migrate, Result};
use std::process;

/// We added new settings metadata, `aws.config.setting-generator`
fn run() -> Result<()> {
migrate(AddMetadataMigration(&[SettingMetadata {
metadata: &["setting-generator"],
setting: "settings.aws.config",
}]))
}

// Returning a Result from main makes it print a Debug representation of the error, but with Snafu
// we have nice Display representations of the error, so we wrap "main" (run) and print any error.
// https://github.com/shepmaster/snafu/issues/110
fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}
3 changes: 3 additions & 0 deletions sources/shared-defaults/aws-creds.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[settings.aws]
profile = "default"

[metadata.settings.aws.config]
setting-generator = "schnauzer-v2 render --requires 'aws@v1(helpers=[aws_config])' --template '{{ aws_config settings.aws.config settings.aws.profile }}'"

[services.aws]
configuration-files = [
"aws-config",
Expand Down

0 comments on commit 0c163e1

Please sign in to comment.