env.ts

Declarations
#

5 declarations

view source

is_private_env
#

env.ts view source

(key: string, public_prefix: string, private_prefix: string): boolean

key

type string

public_prefix

type string

private_prefix

type string

returns

boolean

is_public_env
#

env.ts view source

(key: string, public_prefix: string, private_prefix: string): boolean

key

type string

public_prefix

type string

private_prefix

type string

returns

boolean

load_env
#

env.ts view source

(dev: boolean, visibility: "public" | "private", public_prefix: string, private_prefix: string, env_dir?: string | undefined, env_files?: string[], ambient_env?: ProcessEnv): Record<...>

dev

type boolean

visibility

type "public" | "private"

public_prefix

type string

private_prefix

type string

env_dir?

type string | undefined
optional

env_files

type string[]
default ['.env', '.env.' + (dev ? 'development' : 'production')]

ambient_env

type ProcessEnv
default process.env

returns

Record<string, string>

load_from_env
#

env.ts view source

(key: string, paths?: string[]): string | undefined

Loads a single env value without merging it into process.env. By default searches process.env, then a local .env if one exists, then ../.env if it exists. Empty strings are semantically the same as undefined for more ergonomic fallbacks.

key

type string

paths

type string[]
default ['.env', '../.env']

returns

string | undefined

merge_envs
#

env.ts view source

(envs: Record<string, string | undefined>[], visibility: "public" | "private", public_prefix: string, private_prefix: string): Record<string, string>

envs

type Record<string, string | undefined>[]

visibility

type "public" | "private"

public_prefix

type string

private_prefix

type string

returns

Record<string, string>

Imported by
#