LoRaWAN-Signal-Mapping/server/bootstrap/container.mjs

26 lines
627 B
JavaScript

"use strict";
import a from 'awilix';
import Ansi from '../Helpers/Ansi.mjs';
import TTNAppServer from '../ttn-app-server/TTNAppServer.mjs';
import settings from './settings.mjs';
import database_init from '../bootstrap/database_init.mjs';
const c = a.createContainer({
injectionMode: a.InjectionMode.PROXY
});
c.register({
settings: a.asValue(settings),
ansi: a.asFunction(() => new Ansi()).singleton(),
database: a.asFunction(database_init).singleton(),
TTNAppServer: a.asClass(TTNAppServer),
});
c.loadModules("../Repos.SQLite/*.mjs", {
register: a.asClass,
lifetime: a.Lifetime.SINGLETON
});
export default c;