add missing db-name

This commit is contained in:
jem 2021-09-14 19:38:57 +02:00
parent 60baab6a8c
commit d66189bd9f
6 changed files with 18 additions and 5 deletions

View file

@ -31,9 +31,12 @@
(throw (js/Error. "Undefined Resource!")))))
(defn generate-config [& args]
(let [{:keys [postgres-size]
:or {postgres-size :2gb}} args]
(yaml/from-string (yaml/load-resource (str "postgres/config-" (name postgres-size) ".yaml")))))
(let [{:keys [postgres-size db-name]
:or {postgres-size :2gb
db-name "postgres"}} args]
(->
(yaml/from-string (yaml/load-resource (str "postgres/config-" (name postgres-size) ".yaml")))
(assoc-in [:data :postgres-db] db-name))))
(defn generate-deployment []
(yaml/from-string (yaml/load-resource "postgres/deployment.yaml")))

View file

@ -5,6 +5,7 @@ metadata:
labels:
app: postgres
data:
postgres-db: postgres
postgresql.conf: |
max_connections = 1000
work_mem = 4MB

View file

@ -5,6 +5,7 @@ metadata:
labels:
app: postgres
data:
postgres-db: postgres
postgresql.conf: |
max_connections = 100
work_mem = 4MB

View file

@ -5,6 +5,7 @@ metadata:
labels:
app: postgres
data:
postgres-db: postgres
postgresql.conf: |
max_connections = 500
work_mem = 2MB

View file

@ -5,6 +5,7 @@ metadata:
labels:
app: postgres
data:
postgres-db: postgres
postgresql.conf: |
max_connections = 700
work_mem = 3MB

View file

@ -5,12 +5,18 @@
[dda.c4k-common.postgres :as cut]))
(deftest should-generate-config
(is (= {:postgresql.conf
(is (= {:postgres-db "postgres"
:postgresql.conf
"max_connections = 100\nwork_mem = 4MB\nshared_buffers = 512MB\n"}
(:data (cut/generate-config))))
(is (= {:postgresql.conf
(is (= {:postgres-db "postgres"
:postgresql.conf
"max_connections = 700\nwork_mem = 3MB\nshared_buffers = 2048MB\n"}
(:data (cut/generate-config :postgres-size :8gb))))
(is (= {:postgres-db "test"
:postgresql.conf
"max_connections = 100\nwork_mem = 4MB\nshared_buffers = 512MB\n"}
(:data (cut/generate-config :db-name "test"))))
)
(deftest should-generate-persistent-volume