2019-05-23 19:10:06 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
import a from 'awilix';
|
|
|
|
|
2019-05-23 21:26:31 +00:00
|
|
|
import Ansi from '../Helpers/Ansi.mjs';
|
2019-05-29 10:59:40 +00:00
|
|
|
import Log from '../Helpers/Log.mjs';
|
2019-05-23 19:10:06 +00:00
|
|
|
import TTNAppServer from '../ttn-app-server/TTNAppServer.mjs';
|
|
|
|
|
2019-05-23 21:26:31 +00:00
|
|
|
import settings from './settings.mjs';
|
|
|
|
import database_init from '../bootstrap/database_init.mjs';
|
|
|
|
|
2019-05-23 19:10:06 +00:00
|
|
|
const c = a.createContainer({
|
|
|
|
injectionMode: a.InjectionMode.PROXY
|
|
|
|
});
|
|
|
|
|
|
|
|
c.register({
|
2019-05-23 21:26:31 +00:00
|
|
|
settings: a.asValue(settings),
|
2019-05-29 10:59:40 +00:00
|
|
|
ansi: a.asClass(Ansi).singleton(),
|
|
|
|
log: a.Class(Log).singleton(),
|
2019-05-23 19:10:06 +00:00
|
|
|
database: a.asFunction(database_init).singleton(),
|
|
|
|
TTNAppServer: a.asClass(TTNAppServer),
|
|
|
|
});
|
2019-05-29 10:59:40 +00:00
|
|
|
|
2019-05-23 20:01:32 +00:00
|
|
|
c.loadModules("../Repos.SQLite/*.mjs", {
|
|
|
|
register: a.asClass,
|
|
|
|
lifetime: a.Lifetime.SINGLETON
|
|
|
|
});
|
2019-05-23 19:10:06 +00:00
|
|
|
|
|
|
|
export default c;
|