diff options
author | Michael McVady <femtonaut@gmail.com> | 2023-01-02 20:24:50 -0600 |
---|---|---|
committer | Michael McVady <femtonaut@gmail.com> | 2023-01-03 10:54:24 -0600 |
commit | 96658d75dfb8a5106366e211ed5fa70d77a0c740 (patch) | |
tree | 2ba4c35b4a507fa06db3e5714cf31884964acc5e /src/init.c | |
parent | 03eafcbb94df67484e80480f30660022e7142608 (diff) |
Formatting
Diffstat (limited to 'src/init.c')
-rw-r--r-- | src/init.c | 24 |
1 files changed, 2 insertions, 22 deletions
@@ -7,8 +7,7 @@ void kore_parent_configure(int, char **); static const char *database = "db"; void -kore_parent_configure(int argc, char **argv) -{ +kore_parent_configure(int argc, char **argv) { int err = 0; kore_default_getopt(argc, argv); @@ -21,8 +20,7 @@ kore_parent_configure(int argc, char **argv) } int -init_db(void) -{ +init_db(void) { int err = 0; const char *pg_config = NULL; @@ -41,49 +39,31 @@ init_db(void) // Parse env vars and build PostgreSQL config string env = getenv("POSTGRES_HOST"); if (env) - { kore_buf_appendf(pg_config_buf, "host=%s ", env); - } else - { kore_buf_append(pg_config_buf, host, strlen(host)); - } env = getenv("POSTGRES_PORT"); if (env) - { kore_buf_appendf(pg_config_buf, "port=%s ", env); - } else - { kore_buf_append(pg_config_buf, port, strlen(port)); - } env = getenv("POSTGRES_USER"); if (env) - { kore_buf_appendf(pg_config_buf, "user=%s ", env); - } else - { kore_buf_append(pg_config_buf, user, strlen(user)); - } env = getenv("POSTGRES_PASSWORD"); if (env) - { kore_buf_appendf(pg_config_buf, "password=%s ", env); - } env = getenv("POSTGRES_DBNAME"); if (env) - { kore_buf_appendf(pg_config_buf, "user=%s ", env); - } else - { kore_buf_append(pg_config_buf, dbname, strlen(dbname)); - } kore_buf_append(pg_config_buf, sslmode, strlen(sslmode)); |