mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
Remove CONFIG_PATH env var
This commit is contained in:
parent
f93d058f55
commit
3a9483dbfb
@ -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=
|
10
src/index.js
10
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 => {
|
||||
|
Loading…
Reference in New Issue
Block a user