diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-05-19 18:26:06 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-05-19 18:26:06 +0200 |
commit | 7d8a74adf1a0b2451140aa07c183b12d16ae6a38 (patch) | |
tree | 66b02b43ab17c42314dbf1e18e04a845086dc1e3 /src/exchangedb/plugin_exchangedb_postgres.c | |
parent | 14436d1241ef2c37c4cee92dc1a3c61ab3d6b1dc (diff) |
allow env override
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index aaf565d27..c5965ae1f 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -4297,6 +4297,7 @@ libtaler_plugin_exchangedb_postgres_init (void *cls) struct GNUNET_CONFIGURATION_Handle *cfg = cls; struct PostgresClosure *pg; struct TALER_EXCHANGEDB_Plugin *plugin; + const char *ec; pg = GNUNET_new (struct PostgresClosure); @@ -4307,17 +4308,25 @@ libtaler_plugin_exchangedb_postgres_init (void *cls) GNUNET_free (pg); return NULL; } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - "exchangedb-postgres", - "db_conn_str", - &pg->connection_cfg_str)) + ec = getenv ("TALER_EXCHANGEDB_POSTGRES_CONFIG"); + if (NULL != ec) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchangedb-postgres", - "db_conn_str"); - GNUNET_free (pg); - return NULL; + pg->connection_cfg_str = GNUNET_strdup (ec); + } + else + { + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (cfg, + "exchangedb-postgres", + "db_conn_str", + &pg->connection_cfg_str)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "exchangedb-postgres", + "db_conn_str"); + GNUNET_free (pg); + return NULL; + } } plugin = GNUNET_new (struct TALER_EXCHANGEDB_Plugin); plugin->cls = pg; |