Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
fix: env variables not being read in knex.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
vycdev committed Jul 8, 2020
1 parent f918ac0 commit b63ff89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/api/db/knex.ts
Original file line number Diff line number Diff line change
@@ -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<string, Config>)[environment];

const knex = Knex(environmentConfig as Config);

Expand Down
4 changes: 2 additions & 2 deletions packages/api/knexfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { config } from "dotenv";

config();

export type Configs = Record<string, Config>;
type Configs = Record<string, Config>;

const options = {
client: process.env.DB_CLIENT,
Expand Down Expand Up @@ -48,4 +48,4 @@ const configs: Configs = {

const { development, test, production } = configs;

export const configuration = { development, test, production };
export { development, test, production };

0 comments on commit b63ff89

Please sign in to comment.