From a320b6475d82f79b69ddad1323ed7de0201d349f Mon Sep 17 00:00:00 2001 From: Victor Login Date: Tue, 2 Feb 2021 14:40:42 +0300 Subject: [PATCH] fix: Added the ability to specify db-schema via ENV (#702) --- docs/configuring-unleash.md | 2 +- lib/options.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/configuring-unleash.md b/docs/configuring-unleash.md index 77ba939b43..a740d022d4 100644 --- a/docs/configuring-unleash.md +++ b/docs/configuring-unleash.md @@ -34,7 +34,7 @@ unleash.start(unleashOptions); - _ssl_ - an object describing ssl options, see https://node-postgres.com/features/ssl (`DATABASE_SSL`, as a stringified json object) - _version_ - the postgres database version. Used to connect a non-standard database. Defaults to `undefined`, which let the underlying adapter to detect the version automatically. (`DATABASE_VERSION`) - **databaseUrl** - (_deprecated_) the postgres database url to connect to. Only used if _db_ object is not specified. Should include username/password. This value may also be set via the `DATABASE_URL` environment variable. Alternatively, if you would like to read the database url from a file, you may set the `DATABASE_URL_FILE` environment variable with the full file path. The contents of the file must be the database url exactly. -- **databaseSchema** - the postgres database schema to use. Defaults to 'public'. +- **databaseSchema** - the postgres database schema to use. Defaults to 'public'. (`DATABASE_SCHEMA`) - **port** - which port the unleash-server should bind to. If port is omitted or is 0, the operating system will assign an arbitrary unused port. Will be ignored if pipe is specified. This value may also be set via the `HTTP_PORT` environment variable - **host** - which host the unleash-server should bind to. If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available, or the unspecified IPv4 address (0.0.0.0) otherwise. This value may also be set via the `HTTP_HOST` environment variable - **pipe** - parameter to identify IPC endpoints. See https://nodejs.org/api/net.html#net_identifying_paths_for_ipc_connections for more details diff --git a/lib/options.js b/lib/options.js index 70fffcc2b6..f7fb21e8b7 100644 --- a/lib/options.js +++ b/lib/options.js @@ -22,7 +22,7 @@ function defaultDatabaseUrl() { function defaultOptions() { return { databaseUrl: defaultDatabaseUrl(), - databaseSchema: 'public', + databaseSchema: process.env.DATABASE_SCHEMA || 'public', db: { user: process.env.DATABASE_USERNAME, password: process.env.DATABASE_PASSWORD,