fix(config) configManager: totally move away from singletone

This commit is contained in:
coderaiser 2019-06-04 18:49:03 +03:00
parent 2abe7d688d
commit b6ed7da0a7
16 changed files with 127 additions and 115 deletions

View file

@ -24,6 +24,7 @@ function before(options, fn = options) {
config,
plugins,
modules,
configManager,
} = options;
const app = express();
@ -41,6 +42,7 @@ function before(options, fn = options) {
socket,
plugins,
config: assign(defaultConfig(), config),
configManager,
modules,
}));

View file

@ -21,13 +21,15 @@ const fixture = {
const defaultOptions = {
config: {
auth: false,
root: join(__dirname, '..'),
},
};
const cloudcmd = require(cloudcmdPath);
const serveOnce = require('serve-once');
const {request} = serveOnce(cloudcmd);
const {request} = serveOnce(cloudcmd, defaultOptions);
const once = promisify((name, extract, fn) => {
extract.once(name, (header, stream) => {
@ -76,7 +78,6 @@ test('cloudcmd: rest: pack: tar: put: file', async (t) => {
const name = String(Math.random()) + '.tar.gz';
const cloudcmd = reRequire(cloudcmdPath);
const {request} = serveOnce(cloudcmd, defaultOptions);
await request.put(`/api/v1/pack`, {

View file

@ -7,7 +7,7 @@ const io = require('socket.io-client');
const configPath = path.join(__dirname, '../..', 'server', 'config');
const {connect} = require('../before');
const configFn = require(configPath);
const configFn = require(configPath).createConfig();
test('cloudcmd: console: enabled', async (t) => {
const config = {

View file

@ -4,7 +4,7 @@ const test = require('supertape');
const criton = require('criton');
const cloudcmd = require('..');
const configFn = require('../server/config');
const configFn = cloudcmd.createConfigManager();
const config = {
auth: false,