diff --git a/relay-config/src/config.rs b/relay-config/src/config.rs index a0c17ff258..cb940639e7 100644 --- a/relay-config/src/config.rs +++ b/relay-config/src/config.rs @@ -222,8 +222,8 @@ trait ConfigObject: DeserializeOwned + Serialize { pub struct OverridableConfig { /// The operation mode of this relay. pub mode: Option, - /// The environment in which Relay is run. - pub environment: Option, + /// The deployment of this relay. + pub deployment: Option, /// The log level of this relay. pub log_level: Option, /// The upstream relay or sentry instance. @@ -354,33 +354,33 @@ impl fmt::Display for RelayMode { } } -/// The environment of a Relay. +/// The deployment type of Relay. #[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] -pub enum RelayEnvironment { - /// This Relay is run in a default environment. +pub enum RelayDeployment { + /// This Relay is run in a default deployment. Default, - /// This Relay is run in a canary environment where experiments can be run. + /// This Relay is run in a canary deployment where experiments can be run. Canary, } -impl fmt::Display for RelayEnvironment { +impl fmt::Display for RelayDeployment { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - RelayEnvironment::Default => write!(f, "default"), - RelayEnvironment::Canary => write!(f, "canary"), + RelayDeployment::Default => write!(f, "default"), + RelayDeployment::Canary => write!(f, "canary"), } } } -impl FromStr for RelayEnvironment { +impl FromStr for RelayDeployment { type Err = fmt::Error; fn from_str(s: &str) -> Result { match s { - "canary" => Ok(RelayEnvironment::Canary), - _ => Ok(RelayEnvironment::Default), + "canary" => Ok(RelayDeployment::Canary), + _ => Ok(RelayDeployment::Default), } } } @@ -469,8 +469,8 @@ impl Default for ReadinessCondition { pub struct Relay { /// The operation mode of this relay. pub mode: RelayMode, - /// The environment of this relay. - pub environment: RelayEnvironment, + /// The deployment of this relay. + pub deployment: RelayDeployment, /// The upstream relay or sentry instance. pub upstream: UpstreamDescriptor<'static>, /// The host the relay should bind to (network interface). @@ -498,7 +498,7 @@ impl Default for Relay { fn default() -> Self { Relay { mode: RelayMode::Managed, - environment: RelayEnvironment::Default, + deployment: RelayDeployment::Default, upstream: "https://sentry.io/".parse().unwrap(), host: default_host(), port: 3000, @@ -1643,10 +1643,10 @@ impl Config { .with_context(|| ConfigError::field("mode"))?; } - if let Some(environment) = overrides.environment { - relay.environment = environment - .parse::() - .with_context(|| ConfigError::field("environment"))?; + if let Some(deployment) = overrides.deployment { + relay.deployment = deployment + .parse::() + .with_context(|| ConfigError::field("deployment"))?; } if let Some(log_level) = overrides.log_level { @@ -1862,9 +1862,9 @@ impl Config { self.values.relay.mode } - /// Returns the relay environment. - pub fn relay_environment(&self) -> RelayEnvironment { - self.values.relay.environment + /// Returns the relay deployment. + pub fn relay_deployment(&self) -> RelayDeployment { + self.values.relay.deployment } /// Returns the upstream target as descriptor. diff --git a/relay/src/cli.rs b/relay/src/cli.rs index a2203bccff..6040e93e78 100644 --- a/relay/src/cli.rs +++ b/relay/src/cli.rs @@ -97,7 +97,7 @@ pub fn extract_config_args(matches: &ArgMatches) -> OverridableConfig { secret_key: matches.get_one("secret_key").cloned(), outcome_source: matches.get_one("source_id").cloned(), shutdown_timeout: matches.get_one("shutdown_timeout").cloned(), - environment: matches.get_one("environment").cloned(), + deployment: matches.get_one("environment").cloned(), } } @@ -118,7 +118,7 @@ pub fn extract_config_env_vars() -> OverridableConfig { secret_key: env::var("RELAY_SECRET_KEY").ok(), outcome_source: None, //already extracted in params shutdown_timeout: env::var("SHUTDOWN_TIMEOUT").ok(), - environment: env::var("RELAY_ENVIRONMENT").ok(), + deployment: env::var("RELAY_DEPLOYMENT").ok(), } }