Skip to content
This repository has been archived by the owner on Apr 19, 2020. It is now read-only.

Commit

Permalink
Update auto_database_url.
Browse files Browse the repository at this point in the history
  • Loading branch information
ReilySiegel committed Jan 31, 2019
1 parent 6bf4b29 commit fe85f40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ rollout 100%:
.auto_devops: &auto_devops |
# Auto DevOps variables and functions
[[ "$TRACE" ]] && set -x
auto_database_url=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${CI_ENVIRONMENT_SLUG}-postgres:5432/${POSTGRES_DB}
auto_database_url="jdbc:postgresql://${CI_ENVIRONMENT_SLUG}-postgres:5432/${POSTGRES_DB}?user=${POSTGRES_USER}&password=${POSTGRES_PASSWORD}&sslmode=disable"
export DATABASE_URL=${DATABASE_URL-$auto_database_url}
export CI_APPLICATION_REPOSITORY=$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG
export CI_APPLICATION_TAG=$CI_COMMIT_SHA
Expand Down
14 changes: 5 additions & 9 deletions src/clj/flexblock/db.clj
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@
:admin true})
;; Select the correct db-spec.
db (cond
jdbc-url {:connection-uri (str/replace-first
jdbc-url
#"postgres"
"jdbc:postgresql")
:classname "org.postgresql.Driver"}
jdbc-url {:connection-uri jdbc-url}
jdbc-spec jdbc-spec
:else {:dbtype "h2:mem"
:dbname "flexblockdb"
Expand All @@ -89,10 +85,10 @@
;; Add the seed user, if they don't already exist.
(when-not (db/exists? User :email (:email seed-user))
(db/simple-insert! User
(-> seed-user
(assoc :passwordhash
(h/derive (:password seed-user)))
(dissoc :password))))
(-> seed-user
(assoc :passwordhash
(h/derive (:password seed-user)))
(dissoc :password))))
db))

(mount/defstate db
Expand Down

0 comments on commit fe85f40

Please sign in to comment.