You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
698 B
20 lines
698 B
(ns blog.env)
|
|
|
|
(defn get-port
|
|
"Gets the environment variable PORT. If no variable, then the default port is 3000. Server will listen requests on this port."
|
|
[]
|
|
(or (-> (.-env js/process)
|
|
(.-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!!!")}))
|
|
|