23 lines
770 B
JavaScript
23 lines
770 B
JavaScript
"use strict";
|
|
|
|
import path from 'path';
|
|
import fs from 'fs';
|
|
|
|
import toml from '@iarna/toml';
|
|
|
|
import apply_settings from '../Helpers/apply_settings.mjs';
|
|
|
|
const root_dir = path.dirname(process.argv[1]);
|
|
|
|
let filename_default = path.resolve(root_dir, "./settings.default.toml"),
|
|
filename_custom = path.resolve(root_dir, "../settings.toml");
|
|
|
|
if(!fs.existsSync(filename_custom))
|
|
fs.writeFileSync(filename_custom, `# Custom settings file. This file overrides server/settings.default.toml - refer there of example of settings you can override.\n\n`);
|
|
|
|
let settings = toml.parse(fs.readFileSync(filename_default, "utf-8")),
|
|
settings_override = toml.parse(fs.readFileSync(filename_custom, "utf-8"));
|
|
|
|
apply_settings(settings, settings_override);
|
|
|
|
export default settings;
|