Skip to content

Commit bd1a1e7

Browse files
jchrostek-ddclaude
andcommitted
refactor: rename org_uuid to dd_org_uuid, remove redundant comments
Rename config field to dd_org_uuid to match the DD_ORG_UUID env var. Remove section header comments and inline comments that don't add value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1c1b7d8 commit bd1a1e7

6 files changed

Lines changed: 7 additions & 19 deletions

File tree

bottlecap/src/config/env.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ pub struct EnvConfig {
483483
#[serde(deserialize_with = "deserialize_optional_duration_from_seconds")]
484484
pub api_security_sample_delay: Option<Duration>,
485485

486-
// Delegated Authentication
487486
/// @env `DD_ORG_UUID`
488487
///
489488
/// The Datadog organization UUID. When set, delegated auth is auto-enabled.
@@ -692,8 +691,7 @@ fn merge_config(config: &mut Config, env_config: &EnvConfig) {
692691
merge_option_to_value!(config, env_config, api_security_enabled);
693692
merge_option_to_value!(config, env_config, api_security_sample_delay);
694693

695-
// Delegated Authentication
696-
merge_string!(config, env_config, org_uuid);
694+
merge_string!(config, dd_org_uuid, env_config, org_uuid);
697695
}
698696

699697
#[derive(Debug, PartialEq, Clone, Copy)]
@@ -1055,8 +1053,7 @@ mod tests {
10551053
api_security_enabled: false,
10561054
api_security_sample_delay: Duration::from_secs(60),
10571055

1058-
// Delegated Authentication (not set in env, should be defaults)
1059-
org_uuid: String::default(),
1056+
dd_org_uuid: String::default(),
10601057
};
10611058

10621059
assert_eq!(config, expected_config);

bottlecap/src/config/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ pub struct Config {
364364
pub span_dedup_timeout: Option<Duration>,
365365
pub api_key_secret_reload_interval: Option<Duration>,
366366

367-
// Delegated Authentication
368-
pub org_uuid: String,
367+
pub dd_org_uuid: String,
369368

370369
pub serverless_appsec_enabled: bool,
371370
pub appsec_rules: Option<String>,
@@ -482,8 +481,7 @@ impl Default for Config {
482481
span_dedup_timeout: None,
483482
api_key_secret_reload_interval: None,
484483

485-
// Delegated Authentication
486-
org_uuid: String::default(),
484+
dd_org_uuid: String::default(),
487485

488486
serverless_appsec_enabled: false,
489487
appsec_rules: None,

bottlecap/src/config/yaml.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,7 @@ api_security_sample_delay: 60 # Seconds
10371037
dogstatsd_buffer_size: Some(65507),
10381038
dogstatsd_queue_size: Some(2048),
10391039

1040-
// Delegated Authentication (not set in yaml, should be defaults)
1041-
org_uuid: String::default(),
1040+
dd_org_uuid: String::default(),
10421041
};
10431042

10441043
// Assert that

bottlecap/src/delegated_auth/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub async fn get_delegated_api_key(
6262
aws_credentials = get_snapstart_credentials(&aws_credentials).await?;
6363
}
6464

65-
let proof = generate_auth_proof(&aws_credentials, &aws_config.region, &config.org_uuid)?;
65+
let proof = generate_auth_proof(&aws_credentials, &aws_config.region, &config.dd_org_uuid)?;
6666

6767
let url = get_api_endpoint(&config.site);
6868
info!("Requesting delegated API key from: {}", url);

bottlecap/src/secrets/decrypt.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ use tracing::{debug, error, info, warn};
1919
use crate::delegated_auth;
2020

2121
pub async fn resolve_secrets(config: Arc<Config>, aws_config: Arc<AwsConfig>) -> Option<String> {
22-
// Priority 1: Try delegated auth if DD_ORG_UUID is set
23-
// Delegated auth is auto-enabled when org_uuid is present
24-
if !config.org_uuid.is_empty() {
22+
if !config.dd_org_uuid.is_empty() {
2523
match delegated_auth::get_delegated_api_key(&config, &aws_config).await {
2624
Ok(api_key) => {
2725
info!("Delegated auth API key obtained successfully");
@@ -33,7 +31,6 @@ pub async fn resolve_secrets(config: Arc<Config>, aws_config: Arc<AwsConfig>) ->
3331
}
3432
}
3533

36-
// Priority 2-4: Try AWS secrets (Secrets Manager, KMS, SSM)
3734
let api_key_candidate = if !config.api_key_secret_arn.is_empty()
3835
|| !config.kms_api_key.is_empty()
3936
|| !config.api_key_ssm_arn.is_empty()

integration-tests/lib/stacks/auth.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export class AuthStack extends cdk.Stack {
3838
TS: Date.now().toString(),
3939
};
4040

41-
// Shared IAM role for all auth test functions
4241
const roleName = `${id}-role`;
4342
const role = new iam.Role(this, 'ExecutionRole', {
4443
roleName,
@@ -48,7 +47,6 @@ export class AuthStack extends cdk.Stack {
4847
],
4948
});
5049

51-
// On-demand Node.js function
5250
const nodeFunctionName = `${id}-node`;
5351
const nodeFn = new lambda.Function(this, nodeFunctionName, {
5452
role,
@@ -67,7 +65,6 @@ export class AuthStack extends cdk.Stack {
6765
});
6866
nodeFn.addLayers(extensionLayer);
6967

70-
// SnapStart Java function
7168
const javaFunctionName = `${id}-java`;
7269
const javaFn = new lambda.Function(this, javaFunctionName, {
7370
role,

0 commit comments

Comments
 (0)