feat: dynamical config

This commit is contained in:
DIYgod
2019-09-18 16:37:18 +08:00
parent 5c764f93f3
commit 4526bc411c
2 changed files with 121 additions and 104 deletions

View File

@@ -1,21 +1,25 @@
const app = require('./app');
const config = require('./config');
const pkg = (path) =>
new Promise((resolve) => {
app.callback()(
{
url: path,
method: 'GET',
headers: {},
socket: {},
},
{
setHeader: () => {},
end: (data) => {
resolve(data);
module.exports = {
setConfig: (conf) => {
config.set(conf);
},
request: (path) =>
new Promise((resolve) => {
app.callback()(
{
url: path,
method: 'GET',
headers: {},
socket: {},
},
}
);
});
module.exports = pkg;
{
setHeader: () => {},
end: (data) => {
resolve(data);
},
}
);
}),
};