Skip to content

Commit

Permalink
fix config in replicator
Browse files Browse the repository at this point in the history
After the snake_case renaming, deserializing the settings from env variables was
failing.
  • Loading branch information
imor committed Feb 18, 2025
1 parent 357b296 commit 8e9ee30
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ pub fn get_settings<'a, T: serde::Deserialize<'a>>() -> Result<T, config::Config
configuration_directory.join(environment_filename),
))
// Add in settings from environment variables (with a prefix of APP and '__' as separator)
// E.g. `APP_SINK__BIGQUERY__PROJECT_ID=my-project-id would set `Settings { sink: BigQuery { project_id }}` to my-project-id
// E.g. `APP_SINK__BIG_QUERY__PROJECT_ID=my-project-id would set `Settings { sink: BigQuery { project_id }}` to my-project-id
.add_source(
config::Environment::with_prefix("APP")
.prefix_separator("_")
Expand Down
2 changes: 1 addition & 1 deletion api/src/k8s_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl K8sClient for HttpK8sClient {
}
},
{
"name": "APP_SINK__BIGQUERY__SERVICE_ACCOUNT_KEY",
"name": "APP_SINK__BIG_QUERY__SERVICE_ACCOUNT_KEY",
"valueFrom": {
"secretKeyRef": {
"name": bq_secret_name,
Expand Down
4 changes: 2 additions & 2 deletions replicator/configuration/dev.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
source:
Postgres:
postgres:
host: "localhost"
port: 5432
name: "postgres"
username: "postgres"
slot_name: "replicator_slot"
publication: "replicator_publication"
sink:
BigQuery:
big_query:
project_id: "project-id"
dataset_id: "dataset-id"
2 changes: 1 addition & 1 deletion replicator/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn get_configuration() -> Result<Settings, config::ConfigError> {
configuration_directory.join(environment_filename),
))
// Add in settings from environment variables (with a prefix of APP and '__' as separator)
// E.g. `APP_SINK__BIGQUERY__PROJECT_ID=my-project-id would set `Settings { sink: BigQuery { project_id }}` to my-project-id
// E.g. `APP_SINK__BIG_QUERY__PROJECT_ID=my-project-id would set `Settings { sink: BigQuery { project_id }}` to my-project-id
.add_source(
config::Environment::with_prefix("APP")
.prefix_separator("_")
Expand Down
2 changes: 1 addition & 1 deletion replicator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};

mod configuration;

// APP_SOURCE__POSTGRES__PASSWORD and APP_SINK__BIGQUERY__PROJECT_ID environment variables must be set
// APP_SOURCE__POSTGRES__PASSWORD and APP_SINK__BIG_QUERY__PROJECT_ID environment variables must be set
// before running because these are sensitive values which can't be configured in the config files
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
Expand Down

0 comments on commit 8e9ee30

Please sign in to comment.