From 13578d8c9b2e90a9621c068be1a124cb1bc646a3 Mon Sep 17 00:00:00 2001 From: trivernis Date: Mon, 14 Sep 2020 15:09:43 +0200 Subject: [PATCH] Switch to environment variables for database url Signed-off-by: trivernis --- ormconfig.json | 12 ------------ src/index.ts | 5 ++++- 2 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 ormconfig.json diff --git a/ormconfig.json b/ormconfig.json deleted file mode 100644 index 250b347..0000000 --- a/ormconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "postgres", - "host": "127.17.42.1", - "port": 5432, - "username": "apollo", - "database": "apollo_test", - "synchronize": true, - "logging": false, - "entities": [ - "dist/model/**/*.js" - ] - } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 1d0e8fb..cf9bdff 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,7 +37,10 @@ async function authenticate (req: any, res: any, next: any) { } } -createConnection().then(async () => { +createConnection({ + type: 'postgres', + url: process.env.POSTGRES_CONNECTION_URL +}).then(async () => { console.log('connected to db'); }).catch(error => console.log(error));