diff --git a/src/main/blog/env.cljs b/src/main/blog/env.cljs index 137c72c..f29856e 100644 --- a/src/main/blog/env.cljs +++ b/src/main/blog/env.cljs @@ -7,3 +7,13 @@ (.-PORT)) "3000")) +(defn get-database-credentials + "Gets the postgres credentials. Defaults: host - postgres, port - 5432, database - postgres, user - postgres, password - 'changeme!!!'." + [] + (let [env (.-env js/process)] + {:host (or (.-POSTGRES_HOST env) "postgres") + :port (or (.-POSTGRES_PORT env) 5432) + :database (or (.-POSTGRES_DATABASE env) "postgres") + :user (or (.-POSTGRES_USER env) "postgres") + :password (or (.-POSTGRES_PASSWORD env) "changeme!!!")})) +