aboutsummaryrefslogtreecommitdiff
path: root/src/init.c
diff options
context:
space:
mode:
authorMichael McVady <femtonaut@gmail.com>2023-01-02 20:24:50 -0600
committerMichael McVady <femtonaut@gmail.com>2023-01-03 10:54:24 -0600
commit96658d75dfb8a5106366e211ed5fa70d77a0c740 (patch)
tree2ba4c35b4a507fa06db3e5714cf31884964acc5e /src/init.c
parent03eafcbb94df67484e80480f30660022e7142608 (diff)
Formatting
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));