mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
feat: Allow postgres connections that require ssl mode (#409)
Closes #261
This commit is contained in:
parent
23e2b4a622
commit
0d481703da
3 changed files with 30 additions and 1 deletions
|
@ -23,6 +23,14 @@ services:
|
||||||
- TRUST_PROXY=0
|
- TRUST_PROXY=0
|
||||||
- DATABASE_URL=postgresql://postgres@postgres/planka
|
- DATABASE_URL=postgresql://postgres@postgres/planka
|
||||||
- SECRET_KEY=notsecretkey
|
- SECRET_KEY=notsecretkey
|
||||||
|
|
||||||
|
# related: https://github.com/knex/knex/issues/2354
|
||||||
|
# As knex does not pass query parameters from the connection string we
|
||||||
|
# have to use environment variables in order to pass the desired values, e.g.
|
||||||
|
# - PGSSLMODE=<value>
|
||||||
|
|
||||||
|
# Configure knex to accept SSL certificates
|
||||||
|
# - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,14 @@ SECRET_KEY=notsecretkey
|
||||||
# TRUST_PROXY=0
|
# TRUST_PROXY=0
|
||||||
# TOKEN_EXPIRES_IN=365 # In days
|
# TOKEN_EXPIRES_IN=365 # In days
|
||||||
|
|
||||||
|
# related: https://github.com/knex/knex/issues/2354
|
||||||
|
# As knex does not pass query parameters from the connection string we
|
||||||
|
# have to use environment variables in order to pass the desired values, e.g.
|
||||||
|
# PGSSLMODE=<value>
|
||||||
|
|
||||||
|
# Configure knex to accept SSL certificates
|
||||||
|
# KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false
|
||||||
|
|
||||||
## Do not edit this
|
## Do not edit this
|
||||||
|
|
||||||
TZ=UTC
|
TZ=UTC
|
||||||
|
|
|
@ -6,9 +6,22 @@ dotenv.config({
|
||||||
path: path.resolve(__dirname, '../.env'),
|
path: path.resolve(__dirname, '../.env'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function buildSSLConfig() {
|
||||||
|
if (process.env.KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE === 'false') {
|
||||||
|
return {
|
||||||
|
rejectUnauthorized: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
client: 'pg',
|
client: 'pg',
|
||||||
connection: process.env.DATABASE_URL,
|
connection: {
|
||||||
|
connectionString: process.env.DATABASE_URL,
|
||||||
|
ssl: buildSSLConfig(),
|
||||||
|
},
|
||||||
migrations: {
|
migrations: {
|
||||||
tableName: 'migration',
|
tableName: 'migration',
|
||||||
directory: path.join(__dirname, 'migrations'),
|
directory: path.join(__dirname, 'migrations'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue