0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-24 23:55:46 -05:00

refactor: use utility to parse the yaml config file

This commit is contained in:
Juan Picado @jotadeveloper 2017-08-05 10:35:14 +02:00
parent d53ce9750b
commit b804e96f4a
No known key found for this signature in database
GPG key ID: 18AC54485952D158

View file

@ -26,7 +26,6 @@ const constants = require('constants');
const fs = require('fs'); const fs = require('fs');
const http = require('http'); const http = require('http');
const https = require('https'); const https = require('https');
const YAML = require('js-yaml');
const Path = require('path'); const Path = require('path');
const URL = require('url'); const URL = require('url');
const server = require('../api/index'); const server = require('../api/index');
@ -58,7 +57,7 @@ try {
} else { } else {
config_path = require('./config-path')(); config_path = require('./config-path')();
} }
config = YAML.safeLoad(fs.readFileSync(config_path, 'utf8')); config = Utils.parseConfigFile(config_path);
logger.logger.warn({file: config_path}, 'config file - @{file}'); logger.logger.warn({file: config_path}, 'config file - @{file}');
} catch (err) { } catch (err) {
logger.logger.fatal({file: config_path, err: err}, 'cannot open config file @{file}: @{!err.message}'); logger.logger.fatal({file: config_path, err: err}, 'cannot open config file @{file}: @{!err.message}');