From 3a9483dbfba1b5aa0f87d3512d9b02c95f4ba70b Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 21 Jul 2022 14:30:03 +0100 Subject: [PATCH] Remove CONFIG_PATH env var --- README.md | 2 +- src/index.js | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0017bbb..3a0707a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -CONFIG_PATH=./user/config.yml DISCORD_SECRET= DISCORD_TOKEN= DB_CONNECTION_URL="mysql://test:password@localhost/tickets0" ENCRYPTION_KEY= HTTP_BIND=8080 HTTP_EXTERNAL=http://localhost:8080 +PORTAL=http://localhost:3000 SUPER= \ No newline at end of file diff --git a/src/index.js b/src/index.js index 9411cb0..8019b3b 100644 --- a/src/index.js +++ b/src/index.js @@ -46,23 +46,21 @@ if (process.env.ENCRYPTION_KEY === undefined) { process.exit(1); } -process.env.CONFIG_PATH ??= './user/config.yml'; // set default config file path - -if (!fs.existsSync(process.env.CONFIG_PATH)) { +if (!fs.existsSync('./user/config.yml')) { const examplePath = './user/example.config.yml'; if (!fs.existsSync(examplePath)) { console.log('\x07' + colours.redBright('The config file does not exist, and the example file is missing so cannot be copied from.')); process.exit(1); } else { console.log('Creating config file...'); - fs.copyFileSync(examplePath, process.env.CONFIG_PATH); - console.log(`Copied config to ${process.env.CONFIG_PATH}`); + fs.copyFileSync(examplePath, './user/config.yml'); + console.log(`Copied config to ${'./user/config.yml'}`); } } console.log(banner(pkg.version)); // print big title -const config = YAML.parse(fs.readFileSync(process.env.CONFIG_PATH, 'utf8')); +const config = YAML.parse(fs.readFileSync('./user/config.yml', 'utf8')); const log = logger(config); process.on('unhandledRejection', error => {