feat: 完成 ApiState Temporal native 开发链
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { loadConfig } from "./src/config";
|
||||
|
||||
const configPath = process.env.APISTATE_CONFIG_PATH;
|
||||
const runtimeId = process.env.APISTATE_RUNTIME_ID;
|
||||
if (!configPath) throw new Error("Vite requires APISTATE_CONFIG_PATH");
|
||||
if (!runtimeId) throw new Error("Vite requires APISTATE_RUNTIME_ID");
|
||||
|
||||
const config = loadConfig(configPath);
|
||||
const target = config.runtime.serverTargets[runtimeId];
|
||||
if (!target) throw new Error(`runtime.serverTargets.${runtimeId} does not exist`);
|
||||
|
||||
export default defineConfig({
|
||||
root: "static",
|
||||
server: {
|
||||
host: target.webListenHost,
|
||||
port: target.webListenPort,
|
||||
strictPort: true,
|
||||
watch: { usePolling: true, interval: 300 },
|
||||
proxy: {
|
||||
"/api": { target: target.webApiBaseUrl, changeOrigin: true },
|
||||
"/health": { target: target.webApiBaseUrl, changeOrigin: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user