import * as fs from "fs";
import { UiEmulatorUtils } from "./ui-emulator-utils";

const CONFIG_PATH = process.argv[2] ;
const config = JSON.parse(fs.readFileSync(CONFIG_PATH, { encoding: "utf8" }));

(function main() {
    serve();
})();

async function serve() {
    await UiEmulatorUtils.serve(
        config.emulatorConfig.relativePath,
        config.emulatorConfig.relativePathToUIPlugins,
        config.pluginServeList,
        {
            jwt: config.jwt,
            authtoken: config.authtoken,
            cellUrl: config.vcdHost,
            scope: config.scope,
            orgName: config.orgName,
            orgId: config.orgId,
            locale: config.locale,
        },
        config.emulatorConfig.devServerArguments);
}