smartdaemon/ts/smartdaemon.classes.smartdaemon.ts

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-09-03 09:29:14 +00:00
import * as plugins from './smartdaemon.plugins';
import { SmartDaemonTemplateManager } from './smartdaemon.classes.templatemanager';
2019-09-03 13:21:30 +00:00
import { SmartDaemonService } from './smartdaemon.classes.service';
import { SmartDaemonSystemdManager } from './smartdaemon.classes.systemdmanager';
2019-09-03 09:29:14 +00:00
export class SmartDaemon {
2019-09-03 13:21:30 +00:00
public serviceMap: plugins.lik.Objectmap<SmartDaemonService>;
public templateManager: SmartDaemonTemplateManager;
public systemdManager: SmartDaemonSystemdManager;
2019-09-03 09:29:14 +00:00
constructor() {
2019-09-03 13:21:30 +00:00
this.serviceMap = new plugins.lik.Objectmap<SmartDaemonService>();
this.templateManager = new SmartDaemonTemplateManager(this);
this.systemdManager = new SmartDaemonSystemdManager(this);
2019-09-03 09:29:14 +00:00
}
2019-09-03 13:24:49 +00:00
public async addService(serviceNameArg: string, commandArg: string, workingDirectory?: string): Promise<SmartDaemonService> {
let serviceToAdd: SmartDaemonService;
2019-09-03 13:21:30 +00:00
const existingService = this.serviceMap.find(serviceArg => {
2019-09-03 13:24:49 +00:00
return serviceArg.name === serviceNameArg;
});
if (!existingService) {
} else {
}
return serviceToAdd;
2019-09-03 09:29:14 +00:00
};
2019-09-03 13:21:30 +00:00
public async init() {
await this.systemdManager.init();
2019-09-03 09:29:14 +00:00
}
2019-09-03 13:21:30 +00:00
}