Skip to content

Commit

Permalink
fixed actions
Browse files Browse the repository at this point in the history
  • Loading branch information
matvp91 committed Oct 11, 2024
1 parent 9ccee0c commit 58f6f48
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Build
name: Build

on:
push:
Expand All @@ -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
7 changes: 2 additions & 5 deletions packages/dashboard/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
10 changes: 7 additions & 3 deletions packages/shared/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<R extends Parameters<typeof t.Object>[0]> = (
Expand All @@ -15,6 +17,8 @@ type ParseEnvResolve<R extends Parameters<typeof t.Object>[0]> = (
export function parseEnv<R extends Parameters<typeof t.Object>[0]>(
resolve: ParseEnvResolve<R>,
) {
loadConfigEnv();

const schema = t.Object(resolve(t));
return Value.Parse(schema, process.env);
}

0 comments on commit 58f6f48

Please sign in to comment.