metamigo-api: work on making it build
This commit is contained in:
parent
38e68852d9
commit
ef216f7b1c
35 changed files with 407 additions and 322 deletions
28
apps/metamigo-api/src/server/index.ts
Normal file
28
apps/metamigo-api/src/server/index.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import * as Metamigo from "@digiresilience/metamigo-common";
|
||||
import { defState } from "@digiresilience/montar";
|
||||
import Manifest from "./manifest";
|
||||
import config, { IAppConfig } from "../config";
|
||||
|
||||
export const deployment = async (
|
||||
config: IAppConfig,
|
||||
start = false
|
||||
): Promise<Metamigo.Server> => {
|
||||
// Build the manifest, which describes all the plugins needed for our application server
|
||||
const manifest = await Manifest.build(config);
|
||||
|
||||
// Create the server and optionally start it
|
||||
const server = Metamigo.deployment(manifest, config, start);
|
||||
|
||||
return server;
|
||||
};
|
||||
|
||||
export const stopDeployment = async (
|
||||
server: Metamigo.Server
|
||||
): Promise<void> => Metamigo.stopDeployment(server);
|
||||
|
||||
const server = defState("server", {
|
||||
start: () => deployment(config, true),
|
||||
stop: () => stopDeployment(server),
|
||||
});
|
||||
|
||||
export default server;
|
||||
Loading…
Add table
Add a link
Reference in a new issue