parent
ac41a4668f
commit
c78af3f7dc
@ -1,19 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const { join } = require('path');
|
||||
const dotenv = require('dotenv');
|
||||
const { readFileSync } = require('fs');
|
||||
const toml = require('toml');
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const CONFIG_ENV = process.env.NODE_ENV === 'production' ? 'prod' : 'dev';
|
||||
const CONFIG_FILENAME = process.env.CONFIG || `config.${CONFIG_ENV}.toml`;
|
||||
const CONFIG_PATH = join(process.cwd(), CONFIG_FILENAME);
|
||||
|
||||
// toml.parse returns an object that doesn't have the correct prototype,
|
||||
// thus this JSON workaround is used.
|
||||
const config = JSON.parse(
|
||||
JSON.stringify(toml.parse(readFileSync(CONFIG_PATH, { encoding: 'utf-8' }))),
|
||||
);
|
||||
|
||||
module.exports = config.database;
|
Loading…
Reference in new issue