From b63ff89b1e2e83cc9ad8b5c3d9dada9adb8cb712 Mon Sep 17 00:00:00 2001 From: Sandu Victor Date: Wed, 8 Jul 2020 22:58:46 +0300 Subject: [PATCH] fix: env variables not being read in knex.ts --- packages/api/db/knex.ts | 4 ++-- packages/api/knexfile.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/api/db/knex.ts b/packages/api/db/knex.ts index 217420d..8c3a1c0 100644 --- a/packages/api/db/knex.ts +++ b/packages/api/db/knex.ts @@ -1,9 +1,9 @@ import Knex, { Config } from "knex"; -import { Configs, configuration } from "../knexfile"; +import * as configs from "../knexfile"; const environment = process.env.NODE_ENV || "development"; -const environmentConfig = (configuration as Configs)[environment]; +const environmentConfig = (configs as Record)[environment]; const knex = Knex(environmentConfig as Config); diff --git a/packages/api/knexfile.ts b/packages/api/knexfile.ts index 9a35cdb..cdefd27 100644 --- a/packages/api/knexfile.ts +++ b/packages/api/knexfile.ts @@ -3,7 +3,7 @@ import { config } from "dotenv"; config(); -export type Configs = Record; +type Configs = Record; const options = { client: process.env.DB_CLIENT, @@ -48,4 +48,4 @@ const configs: Configs = { const { development, test, production } = configs; -export const configuration = { development, test, production }; +export { development, test, production };