Use Ecto compatible DATABASE_URL

integrate-vt
Marcin Kulik 7 years ago
parent 325a03c286
commit d67cd9a9a1

@ -12,7 +12,7 @@ BASE_URL=http://localhost:3000
SECRET_KEY_BASE=
## PostgreSQL connection URL.
## Default: postgresql://postgres/postgres?user=postgres
## Default: postgresql://postgres@postgres/postgres
# DATABASE_URL=
## Redis connection URL.

@ -108,7 +108,7 @@ RUN lein uberjar
COPY . /app
ENV DATABASE_URL "postgresql://postgres/postgres?user=postgres"
ENV DATABASE_URL "postgresql://postgres@postgres/postgres"
ENV REDIS_URL "redis://redis:6379"
# compile terminal.c

@ -50,9 +50,12 @@
(defn- fix-uri [uri]
(when uri
(if (str/starts-with? uri "jdbc:")
uri
(str "jdbc:" uri))))
(let [[_ user _ pass] (re-find #"://([^:@]+)(:([^@]+))?@" uri)]
(cond-> uri
(not (str/starts-with? uri "jdbc:")) (->> (str "jdbc:"))
(str/includes? uri "@") (str/replace #"://[^@]+@" "://")
user (str "?user=" user)
pass (str "&password=" pass)))))
(defn hikaricp [opts]
(let [opts (update opts :uri fix-uri)]

Loading…
Cancel
Save