Skip to content

Commit e5d229b

Browse files
fix(ConfigProvider.fromEnv): use import.meta.env instead of process.env
The reason for this is that this allows using environment variables in the browser with vite. Vite has a feature where all environment variables that have a VITE_ prefix are exposed in import.meta.env. And even in node.js import.meta.env is a alias to process.env so i don't see any reason why ConfigProvider.fromEnv only supported process.env
1 parent b707249 commit e5d229b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

packages/effect/src/internal/configProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ export const fromEnv = (
108108
const makePathString = (path: ReadonlyArray<string>): string => pipe(path, Arr.join(pathDelim))
109109
const unmakePathString = (pathString: string): ReadonlyArray<string> => pathString.split(pathDelim)
110110

111-
const getEnv = () =>
112-
typeof process !== "undefined" && "env" in process && typeof process.env === "object" ? process.env : {}
111+
const getEnv = () => import.meta.env;
113112

114113
const load = <A>(
115114
path: ReadonlyArray<string>,

0 commit comments

Comments
 (0)