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

View file

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