mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-27 17:54:11 +00:00
fix(config) configManager: totally move away from singletone
This commit is contained in:
parent
2abe7d688d
commit
b6ed7da0a7
16 changed files with 127 additions and 115 deletions
|
|
@ -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,
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -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`, {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue