trilium/services/config.js

20 lines
555 B
JavaScript
Raw Normal View History

2017-10-22 09:10:33 +08:00
"use strict";
const ini = require('ini');
const fs = require('fs');
const dataDir = require('./data_dir');
const path = require('path');
const configSampleFilePath = path.resolve(__dirname, "..", "config-sample.ini");
const configFilePath = dataDir.TRILIUM_DATA_DIR + '/config.ini';
if (!fs.existsSync(configFilePath)) {
const configSample = fs.readFileSync(configSampleFilePath).toString('utf8');
fs.writeFileSync(configFilePath, configSample);
}
const config = ini.parse(fs.readFileSync(configFilePath, 'utf-8'));
module.exports = config;