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

31 lines
795 B
JavaScript

"use strict";
import a from 'awilix';
import Ansi from '../Helpers/Ansi.mjs';
import Log from '../Helpers/Log.mjs';
import TTNAppServer from '../ttn-app-server/TTNAppServer.mjs';
import MessageHandler from '../ttn-app-server/MessageHandler.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.asClass(Ansi).singleton(),
log: a.asClass(Log).singleton(),
database: a.asFunction(database_init).singleton(),
TTNAppServer: a.asClass(TTNAppServer),
MessageHandler: a.asClass(MessageHandler)
});
c.loadModules("../Repos.SQLite/*.mjs", {
register: a.asClass,
lifetime: a.Lifetime.SINGLETON
});
export default c;