Skip to content

Commit 0c309dd

Browse files
placeksgillespie
authored andcommitted
Add ENV variable handler to provide custom configuration to dbsync
This commit introduces a new environment variable, CARDANO_DB_SYNC_CONFIG, allowing users to specify a custom configuration file for the Cardano db-sync service. The modification in `nix/nixos/cardano-db-sync-service.nix` adds a conditional check to use the custom configuration file if the environment variable is set, providing more flexibility in deployment scenarios and facilitating custom configurations without altering the base code. This change addresses a need for dynamic configuration management as specified in the recent user requirements.
1 parent 9437154 commit 0c309dd

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

nix/nixos/cardano-db-sync-service.nix

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,23 @@ in {
217217
LEDGER_OPTS="--state-dir ${cfg.stateDir}"
218218
fi
219219
220-
exec ${exec} \
221-
--config ${configFile} \
222-
--socket-path "$CARDANO_NODE_SOCKET_PATH" \
223-
--schema-dir ${self.schema} \
224-
${toString cfg.rtsArgs} \
225-
''${LEDGER_OPTS} \
226-
''${EXTRA_DB_SYNC_ARGS:-}
220+
if [[ -z "''${CARDANO_DB_SYNC_CONFIG:-}" ]]; then
221+
exec ${exec} \
222+
--config ${configFile} \
223+
--socket-path "$CARDANO_NODE_SOCKET_PATH" \
224+
--schema-dir ${self.schema} \
225+
${toString cfg.rtsArgs} \
226+
''${LEDGER_OPTS} \
227+
''${EXTRA_DB_SYNC_ARGS:-}
228+
else
229+
exec ${exec} \
230+
--config "$CARDANO_DB_SYNC_CONFIG" \
231+
--socket-path "$CARDANO_NODE_SOCKET_PATH" \
232+
--schema-dir ${self.schema} \
233+
${toString cfg.rtsArgs} \
234+
''${LEDGER_OPTS} \
235+
''${EXTRA_DB_SYNC_ARGS:-}
236+
fi
227237
'';
228238
in {
229239
pgpass = builtins.toFile "pgpass" "${cfg.postgres.socketdir}:${

0 commit comments

Comments
 (0)