readEnvFiles
Reads the env files of a mode from a folder.
Reads the env files of a mode from a folder. Every key of every file is read; the files are layered in the order of
layersOf, later files winning, and ${NAME} references are expanded. A name declared in a public file is public; a
name declared only in the other files is a server variable.
Import#
ts
import { readEnvFiles } from "@shadow-js/dusk/vite";
Signature#
ts
function readEnvFiles(mode: string, envDir: string): EnvFiles
Parameters#
| Name | Description |
|---|---|
mode |
Vite's mode (development, production, or a custom one). |
envDir |
The folder of the env files; a missing file is skipped. |
Returns#
The layered values with their sources and the public and server names.
Examples#
ts
readEnvFiles("development", "/app").publicNames; // ["SITE_URL"]