import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
import { parseServerConfig } from "@shun-js/shun-config";

const config = await parseServerConfig(process.argv);
if (!config) {
  console.log("read server config fail");
  process.exit(1);
}

const packageDir = dirname(fileURLToPath(import.meta.url));
const { start } = await import("./dist/index.js");
await start({ ...config, packageDir });
