Update TTNAppServer to use awilix DI container

This commit is contained in:
Starbeamrainbowlabs 2019-05-23 22:39:10 +01:00
parent 0d3edd0a93
commit ed256c1e76
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,6 @@
import c from './bootstrap/container.mjs';
import show_help from './help.mjs';
import TTNAppServer from './ttn-app-server/TTNAppServer.mjs';
const settings = c.resolve("settings");
const a = c.resolve("ansi");
@ -48,7 +47,7 @@ if(extras.length < 1) {
switch(extras[0]) {
case "ttn-app-server":
let app_server = new TTNAppServer(settings);
let app_server = c.resolve("TTNAppServer");
app_server.run();
break;

View File

@ -3,8 +3,9 @@
import ansi from '../Helpers/Ansi.mjs';
class TTNAppServer {
constructor(in_settings) {
this.settings = in_settings;
// Destructure the awilix container
constructor({ settings }) {
this.settings = settings;
}
run() {