/
main.ts
53 lines (37 loc) · 1.89 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
This file is part of botten-nappet -- a Twitch bot and streaming tool.
<https://joelpurra.com/projects/botten-nappet/>
Copyright (c) 2018 Joel Purra <https://joelpurra.com/>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// NOTE: single-import adding reflection metadata globally.
import "reflect-metadata";
import {
Container,
} from "aurelia-dependency-injection";
import configLibrary from "config";
import loadPackageJson from "@botten-nappet/shared/src/util/load-package-json";
import PinoLogger from "@botten-nappet/shared/src/util/pino-logger";
import RootLoggerResolver from "@botten-nappet/shared/src/util/root-logger-resolver";
import SharedContainerRoot from "./shared-container-root";
export default async function main(): Promise<void> {
const rootContainer = new Container();
rootContainer.registerInstance("IConfig", configLibrary);
const packageJson = await loadPackageJson();
rootContainer.registerInstance("IPackageJson", packageJson);
const rootLoggerResolver = rootContainer.get(RootLoggerResolver);
const rootLogger = rootLoggerResolver.get();
rootContainer.registerInstance(PinoLogger, rootLogger);
const sharedContainerRoot = rootContainer.get(SharedContainerRoot) as SharedContainerRoot;
await sharedContainerRoot.start();
await sharedContainerRoot.stop();
}