Skip to content

Commit

Permalink
refactor(source): prefer options_with_secret over with_properties
Browse files Browse the repository at this point in the history
… in `SpecificParserConfig::new` (#19900)
  • Loading branch information
xiangjinwu authored Dec 31, 2024
1 parent 705cdf1 commit 1d4ab61
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/connector/src/parser/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@ impl SpecificParserConfig {
let format_encode_options_with_secret = LocalSecretManager::global()
.fill_secrets(info.format_encode_options, info.format_encode_secret_refs)?;
let (options, secret_refs) = with_properties.clone().into_parts();
// Make sure `with_properties` is no longer used by accident.
// All reads shall go to `options_with_secret` instead.
#[expect(unused_variables)]
let with_properties = ();
let options_with_secret =
LocalSecretManager::global().fill_secrets(options.clone(), secret_refs.clone())?;
LocalSecretManager::global().fill_secrets(options, secret_refs)?;
let format = source_struct.format;
let encode = source_struct.encode;
// this transformation is needed since there may be config for the protocol
Expand Down Expand Up @@ -165,7 +169,7 @@ impl SpecificParserConfig {
client_config: SchemaRegistryAuth::from(&format_encode_options_with_secret),
name_strategy: PbSchemaRegistryNameStrategy::try_from(info.name_strategy)
.unwrap(),
topic: get_kafka_topic(with_properties)?.clone(),
topic: get_kafka_topic(&options_with_secret)?.clone(),
}
} else {
SchemaLocation::File {
Expand Down Expand Up @@ -228,7 +232,7 @@ impl SpecificParserConfig {
client_config: SchemaRegistryAuth::from(&format_encode_options_with_secret),
name_strategy: PbSchemaRegistryNameStrategy::try_from(info.name_strategy)
.unwrap(),
topic: get_kafka_topic(with_properties).unwrap().clone(),
topic: get_kafka_topic(&options_with_secret).unwrap().clone(),
},
..Default::default()
})
Expand Down

0 comments on commit 1d4ab61

Please sign in to comment.