MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromDotEnvContents

Function fromDotEnvContents

packages/effect/src/ConfigProvider.ts:1082–1091  ·  view source on GitHub ↗
(lines: string, options?: {
  readonly expandVariables?: boolean | undefined
  readonly preserveEmptyStrings?: boolean | undefined
})

Source from the content-addressed store, hash-verified

1080 * @since 4.0.0
1081 */
1082export function fromDotEnvContents(lines: string, options?: {
1083 readonly expandVariables?: boolean | undefined
1084 readonly preserveEmptyStrings?: boolean | undefined
1085}): ConfigProvider {
1086 let env = parseDotEnvContents(lines)
1087 if (options?.expandVariables) {
1088 env = dotEnvExpand(env)
1089 }
1090 return fromEnvRecord(env, { preserveEmptyStrings: options?.preserveEmptyStrings })
1091}
1092
1093const DOT_ENV_LINE =
1094 /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg

Callers 1

ConfigProvider.tsFile · 0.85

Calls 3

parseDotEnvContentsFunction · 0.85
dotEnvExpandFunction · 0.85
fromEnvRecordFunction · 0.85

Tested by

no test coverage detected