Skip to content

Commit

Permalink
Add CLOUDTRUTH_PROJECT to sub-process run environment
Browse files Browse the repository at this point in the history
  • Loading branch information
rickporter-tuono authored Apr 20, 2021
1 parent 3a1e7ce commit 282ee3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ pub const CT_SERVER_URL: &str = "CLOUDTRUTH_SERVER_URL";
// Environment variable name used to set the environment name.
pub const CT_ENVIRONMENT: &str = "CLOUDTRUTH_ENVIRONMENT";

// Environment variable name use to set the project name.
pub const CT_PROJECT: &str = "CLOUDTRUTH_PROJECT";

// List of variables to remove to make a clean environment.
#[allow(dead_code)]
pub const CT_APP_REMOVABLE_VARS: &[&str] = &[CT_SERVER_URL, CT_API_KEY, CT_OLD_API_KEY];
Expand Down
11 changes: 10 additions & 1 deletion src/subprocess.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::config::{CT_APP_REMOVABLE_VARS, CT_ENVIRONMENT, DEFAULT_ENV_NAME};
use crate::config::{
CT_APP_REMOVABLE_VARS, CT_ENVIRONMENT, CT_PROJECT, DEFAULT_ENV_NAME, DEFAULT_PROF_NAME,
};
use crate::graphql::GraphQLError;
use crate::parameters::Parameters;
use crate::{warn_user, ResolvedIds};
Expand Down Expand Up @@ -185,6 +187,13 @@ impl SubProcessIntf for SubProcess {
.clone()
.unwrap_or_else(|| DEFAULT_ENV_NAME.to_string()),
);
self.env_vars.insert(
CT_PROJECT.to_string(),
resolved
.proj_name
.clone()
.unwrap_or_else(|| DEFAULT_PROF_NAME.to_string()),
);

// Add in the items from the CloudTruth environment (looking for collisions)
let mut collisions: Vec<String> = vec![];
Expand Down

0 comments on commit 282ee3c

Please sign in to comment.