Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle compose_yml changes for valueless keys #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/plugins/transform/secrets_config.in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ struct ServiceSecrets {
}

impl ServiceSecrets {
fn to_compose_env(&self) -> BTreeMap<String, dc::RawOr<String>> {
fn to_compose_env(&self) -> BTreeMap<String, Option<dc::RawOr<String>>> {
let mut env = BTreeMap::new();
for (var, val) in &self.secrets {
let val = dc::escape(val).expect("escape string should never fail");
env.insert(var.to_owned(), val);
env.insert(var.to_owned(), Some(val));
}
env
}
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/transform/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ impl PluginTransform for Plugin {
// Insert our VAULT_ADDR value into the generated files.
service
.environment
.insert("VAULT_ADDR".to_owned(), dc::escape(generator.addr())?);
.insert("VAULT_ADDR".to_owned(), Some(dc::escape(generator.addr())?));

// Get a list of policy "patterns" that apply to this service.
let mut raw_policies = config.default_policies.clone();
Expand Down Expand Up @@ -351,13 +351,13 @@ impl PluginTransform for Plugin {
.chain_err(|| format!("could not generate token for '{}'", name))?;
service
.environment
.insert("VAULT_TOKEN".to_owned(), dc::escape(token)?);
.insert("VAULT_TOKEN".to_owned(), Some(dc::escape(token)?));

// Add in any extra environment variables.
for (var, val) in &config.extra_environment {
service
.environment
.insert(var.to_owned(), dc::escape(interpolated(val)?)?);
.insert(var.to_owned(), Some(dc::escape(interpolated(val)?)?));
}
}
Ok(())
Expand Down