yapi/server/utils/initConfig.js

13 lines
371 B
JavaScript
Raw Normal View History

const path = require('path');
const fs = require('fs-extra');
const config = require('../config.js');
2017-07-27 11:50:15 +08:00
let runtimePath = config.runtime_path;
2017-07-27 19:49:26 +08:00
fs.ensureDirSync(runtimePath);
fs.ensureDirSync(path.join(runtimePath, 'log'));
let configPath = path.join(runtimePath, 'config.json');
fs.writeFileSync(configPath,
JSON.stringify(config, null, '\t'),
{ encoding: 'utf8' }
);