Browse Source

Update NcConfigFactory.ts & README.md

Extract NC_DB from  DATABASE_URL_FILE when provided
Add DATABASE_URL_FILE reference in README.md

Signed-off-by: Alejandro Giacometti <alejandro.giacometti@gmail.com>
pull/353/head
Alejandro Giacometti 3 years ago
parent
commit
d206ebc112
  1. 1
      README.md
  2. 6
      packages/nocodb/src/lib/utils/NcConfigFactory.ts

1
README.md

@ -168,6 +168,7 @@ docker-compose up
|-------------------------|-----------|----------------------------------------------------------------------------------|--------------------------------------------|
| NC_DB | Yes | See our database URLs | A local SQLite will be created in root folder |
| DATABASE_URL | No | JDBC URL Format. Can be used instead of NC_DB. Used in 1-Click Heroku deployment| |
| DATABASE_URL_FILE | No | path to file containing JDBC URL Format. Can be used instead of NC_DB. Used in 1-Click Heroku deployment| |
| NC_PUBLIC_URL | Yes | Used for sending Email invitations | Best guess from http request params |
| NC_AUTH_JWT_SECRET | Yes | JWT secret used for auth and storing other secrets | A Random secret will be generated |
| NC_SENTRY_DSN | No | For Sentry monitoring | |

6
packages/nocodb/src/lib/utils/NcConfigFactory.ts

@ -1,4 +1,5 @@
import {SqlClientFactory} from 'nc-help';
import fs from 'fs';
import parseDbUrl from "parse-database-url";
import {AuthConfig, DbConfig, MailerConfig, NcConfig} from "../../interface/config";
@ -565,7 +566,10 @@ export default class NcConfigFactory implements NcConfig {
public static jdbcToXcUrl() {
if (process.env.NC_DATABASE_URL || process.env.DATABASE_URL) {
if (process.env.NC_DATABASE_URL_FILE || process.env.DATABASE_URL_FILE) {
const database_url = fs.readFileSync(process.env.NC_DATABASE_URL_FILE || process.env.DATABASE_URL_FILE, 'utf-8');
process.env.NC_DB = this.extractXcUrlFromJdbc(database_url);
} else if (process.env.NC_DATABASE_URL || process.env.DATABASE_URL) {
process.env.NC_DB = this.extractXcUrlFromJdbc(process.env.NC_DATABASE_URL || process.env.DATABASE_URL);
}
}

Loading…
Cancel
Save