Skip to content
Snippets Groups Projects
Commit 108a5326 authored by Kyle Brett's avatar Kyle Brett
Browse files

Set sslmode=disable explicitly for plain Postgres

parent da79f66f
No related branches found
No related tags found
No related merge requests found
......@@ -87,18 +87,22 @@
:sslmode "require"
:sslfactory "org.postgresql.ssl.NonValidatingFactory"}) ; HACK Why enable SSL if we disable certificate validation?
(def ^:const disable-ssl-params
"Params to include in the JDBC connection spec to disable SSL."
{:sslmode "disable"})
(defn- connection-details->spec [_ {:keys [ssl] :as details-map}]
(-> details-map
(update :port (fn [port]
(if (string? port) (Integer/parseInt port)
port)))
(dissoc :ssl) ; remove :ssl in case it's false; DB will still try (& fail) to connect if the key is there
(merge (when ssl ; merging ssl-params will add :ssl back in if desirable
ssl-params))
(merge (if ssl
ssl-params
disable-ssl-params))
(rename-keys {:dbname :db})
kdb/postgres))
(defn- unix-timestamp->timestamp [_ expr seconds-or-milliseconds]
(case seconds-or-milliseconds
:seconds (k/sqlfn :TO_TIMESTAMP expr)
......
......@@ -15,7 +15,8 @@
:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "//localhost:5432/bird_sightings"
:make-pool? true}
:make-pool? true
:sslmode "disable"}
(sql/connection-details->spec (PostgresDriver.) {:ssl false
:host "localhost"
:port 5432
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment