95 lines
3.9 KiB
Clojure
95 lines
3.9 KiB
Clojure
{:system/env
|
|
#profile {:dev :dev
|
|
:test :test
|
|
:prod :prod}
|
|
|
|
:server/http
|
|
{:port #long #or [#env PORT 3000]
|
|
:host #or [#env HTTP_HOST "0.0.0.0"]
|
|
:handler #ig/ref :handler/ring}
|
|
|
|
:handler/ring
|
|
{:router #ig/ref :router/core
|
|
:api-path "/api"
|
|
:cookie-secret #or [#env COOKIE_SECRET "JJCILTOQLMYRBFRU"]
|
|
;; from ring.middleware.defaults. anti-forgery `false` by default because services may not require it
|
|
:site-defaults-config {:params {:urlencoded true
|
|
:multipart true
|
|
:nested true
|
|
:keywordize true}
|
|
:cookies true
|
|
:session {:flash true
|
|
:cookie-name "pmagnus.elprice"
|
|
:cookie-attrs {:max-age 86400
|
|
:http-only true
|
|
:same-site :strict}}
|
|
:security {:anti-forgery false
|
|
:xss-protection {:enable? true,
|
|
:mode :block}
|
|
:frame-options :sameorigin
|
|
:content-type-options :nosniff}
|
|
:static {:resources "public"}
|
|
:responses {:not-modified-responses true
|
|
:absolute-redirects true
|
|
:content-types true
|
|
:default-charset "utf-8"}}}
|
|
|
|
:reitit.routes/api
|
|
{:base-path "/api"
|
|
:env #ig/ref :system/env
|
|
:query-fn #ig/ref :db.sql/query-fn}
|
|
|
|
:router/routes
|
|
{:routes #ig/refset :reitit/routes}
|
|
|
|
:router/core
|
|
{:routes #ig/ref :router/routes
|
|
:env #ig/ref :system/env}
|
|
|
|
:db.sql/connection
|
|
#profile {:dev {:jdbc-url #or [#env JDBC_URL
|
|
#join ["jdbc:postgresql://"
|
|
#or [#env TARGET_HOST "localhost"]
|
|
":"
|
|
#or [#env TARGET_PORT "5432"]
|
|
"/"
|
|
#or [#env TARGET_DB "elprice"]]]
|
|
:username #or [#env TARGET_USER "elprice"]
|
|
:password #or [#env TARGET_PASSWORD "elprice"]}
|
|
:test {:jdbc-url #or [#env JDBC_URL
|
|
#join ["jdbc:postgresql://"
|
|
#or [#env TARGET_HOST "localhost"]
|
|
":"
|
|
#or [#env TARGET_PORT "5432"]
|
|
"/"
|
|
#or [#env TARGET_DB "elprice"]]]
|
|
:username #or [#env TARGET_USER "elprice"]
|
|
:password #or [#env TARGET_PASSWORD "elprice"]}
|
|
:prod {:jdbc-url #or [#env JDBC_URL
|
|
#join ["jdbc:postgresql://"
|
|
#or [#env TARGET_HOST "localhost"]
|
|
":"
|
|
#or [#env TARGET_PORT "5432"]
|
|
"/"
|
|
#or [#env TARGET_DB "elprice"]]]
|
|
:username #or [#env TARGET_USER "elprice"]
|
|
:password #or [#env TARGET_PASSWORD "elprice"]
|
|
:init-size 1
|
|
:min-idle 1
|
|
:max-idle 8
|
|
:max-active 32}}
|
|
|
|
:db.sql/query-fn
|
|
{:conn #ig/ref :db.sql/connection
|
|
:options {}
|
|
:filename "queries.sql"
|
|
:env #ig/ref :system/env}
|
|
|
|
:db.sql/migrations
|
|
{:store :database
|
|
:db {:datasource #ig/ref :db.sql/connection}
|
|
:migrate-on-init? true}
|
|
:reitit.routes/ui {:base-path "",
|
|
:env #ig/ref :system/env
|
|
:query-fn #ig/ref :db.sql/query-fn}}
|