-
Notifications
You must be signed in to change notification settings - Fork 5
/
service-provider.ts
31 lines (24 loc) · 1.06 KB
/
service-provider.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
import { Container, Contracts, Providers } from "@arkecosystem/core-kernel";
import { IOptions } from "./interface";
import Service from "./service";
export class ServiceProvider extends Providers.ServiceProvider {
@Container.inject(Container.Identifiers.LogService)
private readonly logger!: Contracts.Kernel.Logger;
private service = Symbol.for("Service<Notifier>");
public async register(): Promise<void> {
this.logger.info("[deadlock-delegate/notifier] Registering plugin");
this.app.bind(this.service).to(Service).inSingletonScope();
}
public async boot(): Promise<void> {
const options = this.config().all() as unknown as IOptions;
this.app.get<Service>(this.service).listen(options);
this.logger.info("[deadlock-delegate/notifier] Plugin started");
}
public async bootWhen(): Promise<boolean> {
return !!this.config().get("enabled");
}
public async dispose(): Promise<void> {
// TODO: make sure plugin is stopped gracefully
// this.logger.info('Stopped')
}
}