Add custom Postgres schema support

This commit is contained in:
Istvan Richter 2020-03-18 06:04:53 +01:00
parent ce0aaeba7d
commit 31a2138f92
5 changed files with 12 additions and 0 deletions

View file

@ -166,6 +166,7 @@ docker run -it --rm \
-e DB_POSTGRESDB_HOST=<POSTGRES_HOST> \
-e DB_POSTGRESDB_PORT=<POSTGRES_PORT> \
-e DB_POSTGRESDB_USER=<POSTGRES_USER> \
-e DB_POSTGRESDB_SCHEMA=<POSTGRES_SCHEMA> \
-e DB_POSTGRESDB_PASSWORD=<POSTGRES_PASSWORD> \
-v ~/.n8n:/root/.n8n \
n8nio/n8n \
@ -214,6 +215,7 @@ The following environment variables support file input:
- DB_POSTGRESDB_PASSWORD_FILE
- DB_POSTGRESDB_PORT_FILE
- DB_POSTGRESDB_USER_FILE
- DB_POSTGRESDB_SCHEMA_FILE
- N8N_BASIC_AUTH_PASSWORD_FILE
- N8N_BASIC_AUTH_USER_FILE

View file

@ -38,6 +38,7 @@ To use PostgresDB as database you can provide the following environment variable
- `DB_POSTGRESDB_PORT` (default: 5432)
- `DB_POSTGRESDB_USER` (default: 'root')
- `DB_POSTGRESDB_PASSWORD` (default: empty)
- `DB_POSTGRESDB_SCHEMA` (default: 'public')
```bash
@ -47,6 +48,7 @@ export DB_POSTGRESDB_HOST=postgresdb
export DB_POSTGRESDB_PORT=5432
export DB_POSTGRESDB_USER=n8n
export DB_POSTGRESDB_PASSWORD=n8n
export DB_POSTGRESDB_SCHEMA=n8n
n8n start
```

View file

@ -13,5 +13,6 @@ The following environment variables support file input:
- DB_POSTGRESDB_PASSWORD_FILE
- DB_POSTGRESDB_PORT_FILE
- DB_POSTGRESDB_USER_FILE
- DB_POSTGRESDB_SCHEMA_FILE
- N8N_BASIC_AUTH_PASSWORD_FILE
- N8N_BASIC_AUTH_USER_FILE

View file

@ -51,6 +51,12 @@ const config = convict({
default: 'root',
env: 'DB_POSTGRESDB_USER'
},
schema: {
doc: 'PostgresDB Schema',
format: String,
default: 'public',
env: 'DB_POSTGRESDB_SCHEMA'
},
},
mysqldb: {
database: {

View file

@ -57,6 +57,7 @@ export async function init(synchronize?: boolean): Promise<IDatabaseCollections>
password: await GenericHelpers.getConfigValue('database.postgresdb.password') as string,
port: await GenericHelpers.getConfigValue('database.postgresdb.port') as number,
username: await GenericHelpers.getConfigValue('database.postgresdb.user') as string,
schema: await GenericHelpers.getConfigValue('database.postgresdb.schema') as string,
};
break;