Skip to content

Commit

Permalink
config: add DB_SSLMODE for managed/remote PG (mastodon#10210)
Browse files Browse the repository at this point in the history
* config: add DB_SSLMODE for managed/remote PG

* streaming: set PG sslmode, defaults to prefer
  • Loading branch information
Sascha authored and Gargron committed Mar 8, 2019
1 parent 3c40082 commit cd84b43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ default: &default
pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %>
timeout: 5000
encoding: unicode
sslmode: <%= ENV['DB_SSLMODE'] || "prefer" %>

development:
<<: *default
Expand Down Expand Up @@ -31,3 +32,4 @@ production:
host: <%= ENV['DB_HOST'] || 'localhost' %>
port: <%= ENV['DB_PORT'] || 5432 %>
prepared_statements: <%= ENV['PREPARED_STATEMENTS'] || 'true' %>

6 changes: 6 additions & 0 deletions streaming/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ const startWorker = (workerId) => {
host: process.env.DB_HOST || pg.defaults.host,
port: process.env.DB_PORT || pg.defaults.port,
max: 10,
ssl: {
sslmode: process.env.DB_SSLMODE || 'prefer',
},
},

production: {
Expand All @@ -98,6 +101,9 @@ const startWorker = (workerId) => {
host: process.env.DB_HOST || 'localhost',
port: process.env.DB_PORT || 5432,
max: 10,
ssl: {
sslmode: process.env.DB_SSLMODE || 'prefer',
},
},
};

Expand Down

0 comments on commit cd84b43

Please sign in to comment.