Skip to content

Commit 5f8da3e

Browse files
feat: compile time fips mode and no more fallback for gov
1 parent 017d87c commit 5f8da3e

File tree

3 files changed

+41
-64
lines changed

3 files changed

+41
-64
lines changed

bottlecap/Cargo.lock

Lines changed: 30 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bottlecap/src/bin/bottlecap/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ use tokio_util::sync::CancellationToken;
7373
use tracing::{debug, error};
7474
use tracing_subscriber::EnvFilter;
7575

76+
#[cfg(feature = "fips")]
77+
fn log_fips_status() {
78+
debug!("FIPS mode is enabled");
79+
}
80+
81+
#[cfg(not(feature = "fips"))]
82+
fn log_fips_status() {
83+
debug!("FIPS mode is disabled");
84+
}
85+
7686
#[derive(Clone, Deserialize)]
7787
#[serde(rename_all = "camelCase")]
7888
struct RegisterResponse {
@@ -189,6 +199,7 @@ async fn main() -> Result<()> {
189199
let (mut aws_config, config) = load_configs(start_time);
190200

191201
enable_logging_subsystem(&config);
202+
log_fips_status();
192203
let version_without_next = EXTENSION_VERSION.split('-').next().unwrap_or("NA");
193204
debug!("Starting Datadog Extension {version_without_next}");
194205
let client = Client::builder().no_proxy().build().map_err(|e| {

bottlecap/src/config/mod.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,6 @@ fn fallback(figment: &Figment, yaml_figment: &Figment, region: &str) -> Result<(
252252
return Err(ConfigError::UnsupportedField("otel".to_string()));
253253
}
254254

255-
// Govcloud Regions
256-
if region.starts_with("us-gov-") {
257-
log_fallback_reason("gov_region");
258-
return Err(ConfigError::UnsupportedField("gov_region".to_string()));
259-
}
260-
261255
Ok(())
262256
}
263257

@@ -435,16 +429,6 @@ pub mod tests {
435429
Ok(())
436430
});
437431
}
438-
#[test]
439-
fn test_reject_on_gov_region() {
440-
let mock_gov_region = "us-gov-east-1";
441-
let config =
442-
get_config(Path::new(""), mock_gov_region).expect_err("should reject unknown fields");
443-
assert_eq!(
444-
config,
445-
ConfigError::UnsupportedField("gov_region".to_string())
446-
);
447-
}
448432

449433
#[test]
450434
fn test_fallback_on_otel() {

0 commit comments

Comments
 (0)