aboutsummaryrefslogtreecommitdiff
path: root/src/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/init.c')
-rw-r--r--src/init.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/init.c b/src/init.c
index 1664ed6..3208796 100644
--- a/src/init.c
+++ b/src/init.c
@@ -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));