Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions backend/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,27 @@ const configure = () => {
const envPostgresHost = process.env.DB_POSTGRES_HOST || null;
const envPostgresUser = process.env.DB_POSTGRES_USER || null;
const envPostgresName = process.env.DB_POSTGRES_NAME || null;
const envPostgresSslMode = process.env.DB_POSTGRES_SSL_MODE || null;
if (envPostgresHost && envPostgresUser && envPostgresName) {
// we have enough postgres creds to go with postgres
logger.info("Using Postgres configuration");
instance = {
database: {
engine: postgresEngine,
host: envPostgresHost,
port: process.env.DB_POSTGRES_PORT || 5432,
user: envPostgresUser,
password: process.env.DB_POSTGRES_PASSWORD,
name: envPostgresName,
},
keys: getKeys(),
};
return;
}
// we have enough postgres creds to go with postgres
logger.info("Using Postgres configuration");
instance = {
database: {
engine: postgresEngine,
host: envPostgresHost,
port: process.env.DB_POSTGRES_PORT || 5432,
user: envPostgresUser,
password: process.env.DB_POSTGRES_PASSWORD,
name: envPostgresName,
ssl: envPostgresSslMode ? {
sslmode: envPostgresSslMode,
rejectUnauthorized: envPostgresSslMode === "verify-full" ? true : false,
}: false
},
keys: getKeys(),
};
return;
}

const envSqliteFile = process.env.DB_SQLITE_FILE || "/data/database.sqlite";
logger.info(`Using Sqlite: ${envSqliteFile}`);
Expand Down
4 changes: 4 additions & 0 deletions docs/src/setup/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ services:
Custom Postgres schema is not supported, as such `public` will be used.

:::
### Optional: PostgreSQL SSL

You can enable TLS for the PostgreSQL connection with this environment variable:
- DB_POSTGRES_SSL_MODE: (default: not set, can accept verify and verify-full)

## Running on Raspberry PI / ARM devices

Expand Down