diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82bdfac4..e12585e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Test Build +name: Build on: push: @@ -21,6 +21,3 @@ jobs: run: pnpm install - name: Build run: pnpm build - env: - PUBLIC_API_ENDPOINT: gh-actions://api - PUBLIC_STITCHER_ENDPOINT: gh-actions://stitcher diff --git a/packages/dashboard/vite.config.ts b/packages/dashboard/vite.config.ts index eca359aa..bf639097 100644 --- a/packages/dashboard/vite.config.ts +++ b/packages/dashboard/vite.config.ts @@ -2,12 +2,9 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import path from "path"; import { fileURLToPath } from "url"; -import { parseEnv } from "@mixwave/shared"; +import { loadConfigEnv } from "@mixwave/shared"; -parseEnv((t) => ({ - PUBLIC_API_ENDPOINT: t.String(), - PUBLIC_STITCHER_ENDPOINT: t.String(), -})); +loadConfigEnv(); // https://vitejs.dev/config/ export default defineConfig({ diff --git a/packages/shared/src/env.ts b/packages/shared/src/env.ts index 6f738420..db3230d3 100644 --- a/packages/shared/src/env.ts +++ b/packages/shared/src/env.ts @@ -3,9 +3,11 @@ import { Value } from "@sinclair/typebox/value"; import findConfig from "find-config"; import { config } from "dotenv"; -const configPath = findConfig("config.env"); -if (configPath) { - config({ path: configPath }); +export function loadConfigEnv() { + const configPath = findConfig("config.env"); + if (configPath) { + config({ path: configPath }); + } } type ParseEnvResolve[0]> = ( @@ -15,6 +17,8 @@ type ParseEnvResolve[0]> = ( export function parseEnv[0]>( resolve: ParseEnvResolve, ) { + loadConfigEnv(); + const schema = t.Object(resolve(t)); return Value.Parse(schema, process.env); }