mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-30 14:07:10 +03:00
19 lines
477 B
JavaScript
19 lines
477 B
JavaScript
const { readFile } = require('fs/promises');
|
|
const checkFileExists = require('../utils/checkFileExists');
|
|
const initConfig = require('../utils/init/initConfig');
|
|
|
|
const loadConfig = async () => {
|
|
const configExists = await checkFileExists('data/config.json');
|
|
|
|
if (!configExists) {
|
|
await initConfig();
|
|
}
|
|
|
|
const config = await readFile('data/config.json', 'utf-8');
|
|
const parsedConfig = JSON.parse(config);
|
|
|
|
return parsedConfig;
|
|
};
|
|
|
|
module.exports = loadConfig;
|