import { ServiceCore, Application, getLog, Util, Core } from 'service-core' import * as index from './index.mjs' let util = new Util(import.meta.url) const helloWorldConfig = { "provider": "git", "url": "https://git.nfp.is/api/v1/repos/thething/sc-helloworld/releases", "port": 8888, "scAllowStop": true, } var core = new ServiceCore('sc-manager', import.meta.url) core.log = getLog('sc-manager', [{ "stream": process.stdout, "level": "info" }]) core.config['hello-world'] = helloWorldConfig core.config.allowRestart = true core.setConfig({ port: 4271, }) core.init(index).then(function() { let coreLogger = getLog('service-core') core.core.log = coreLogger core.core.db.log = coreLogger let provConstructor = Core.providers.get(core.db.config['hello-world'].provider) let provider = new provConstructor(core.db.config['hello-world']) let helloWorld = new Application({ db: core.db, util: util, log: getLog('hello-world'), core: core.core, }, provider, 'hello-world') core.core.applications.push(helloWorld) core.core.applicationMap.set('hello-world', helloWorld) helloWorld.startAutoupdater() return core.run() }).then(function() { // return core.core.applicationMap.get('hello-world').update() }).then(function() { // return core.core.runApplication(core.core.applicationMap.get('hello-world')) }).then(function() { let helloApp = core.core.applicationMap.get('hello-world') helloApp.on('updated', core.core.runApplication.bind(core.core, helloApp)) })