(options?: {
readonly env?: Record<string, string> | undefined
readonly preserveEmptyStrings?: boolean | undefined
})
| 953 | * @since 2.0.0 |
| 954 | */ |
| 955 | export function fromEnv(options?: { |
| 956 | readonly env?: Record<string, string> | undefined |
| 957 | readonly preserveEmptyStrings?: boolean | undefined |
| 958 | }): ConfigProvider { |
| 959 | if (options?.env !== undefined) { |
| 960 | return fromEnvRecord(options.env, options) |
| 961 | } |
| 962 | let provider: ConfigProvider | undefined |
| 963 | return make((path) => |
| 964 | Effect.suspend(() => |
| 965 | (provider ??= fromEnvRecord({ |
| 966 | ...(globalThis as { |
| 967 | readonly process?: { readonly env?: Record<string, string | undefined> } |
| 968 | }).process?.env, |
| 969 | ...(import.meta as any)?.env |
| 970 | }, options)).load(path) |
| 971 | ) |
| 972 | ) |
| 973 | } |
| 974 | |
| 975 | type EnvTrieNode = { |
| 976 | children?: Record<string, EnvTrieNode> |
no test coverage detected