/* jslint node: true, esnext: true */

"use strict";

const path = require('path'),
	service = require('kronos-service'),
	route = require('koa-route');

module.exports.registerWithManager = function (manager) {
	manager.registerModules(['kronos-flow', 'kronos-adapter-inbound-http', 'kronos-http-routing-step',
		'kronos-flow-control-step'
	]);

	const koaService = manager.serviceGet('koa-service');

	const adminService = manager.serviceDeclare('koa-service', {
		name: 'admin',
		__start() {
			return koaService.start().then(service => manager.loadFlowFromFile(path.join(__dirname, '..', 'admin.flow')).then(
				flow =>
				flow.start()));
		}
	});

	adminService.koa.use(route.get('/health', ctx => {
		ctx.body = "OK";
	}));
};

@@ -475,16 +475,35 @@
 admin',%0A
+%09%09autostart: true,%0A
 %09%09__star

autostart: true