th: sure. why not. let's interpolate DB_HOST.
This commit is contained in:
parent
e60d9bed75
commit
276954bfd0
1 changed files with 6 additions and 0 deletions
|
@ -94,6 +94,12 @@ const parseJSON = (json, req) => {
|
||||||
* @returns {Object.<string, any>} the configuration for the PostgreSQL connection
|
* @returns {Object.<string, any>} the configuration for the PostgreSQL connection
|
||||||
*/
|
*/
|
||||||
const pgConfigFromEnv = (env) => {
|
const pgConfigFromEnv = (env) => {
|
||||||
|
if (env.DB_HOST) {
|
||||||
|
env.DB_HOST = env.DB_HOST.replaceAll(/\$\w+|\$\{\w+\}/g, (match) => {
|
||||||
|
const name = match.startsWith('${') ? match.slice(2, -1) : match.slice(1);
|
||||||
|
return env[name];
|
||||||
|
});
|
||||||
|
}
|
||||||
const pgConfigs = {
|
const pgConfigs = {
|
||||||
development: {
|
development: {
|
||||||
user: env.DB_USER || pg.defaults.user,
|
user: env.DB_USER || pg.defaults.user,
|
||||||
|
|
Loading…
Reference in a new issue