PhoenixAssets.Generators.Env (PhoenixAssets v0.1.0)

View Source

Generates a typed, allow-listed environment module for the frontend.

Emits env.ts from the explicitly exposed values under config :phoenix_assets, :env, expose: [...]. Only the listed keys are emitted -- nothing is read from the OS environment at generation time -- so the output is deterministic and no secret can leak by accident.

Configuration

config :phoenix_assets, :env,
  expose: [app_name: "MyApp", deployment_env: "dev", public_api_base: "/api"]

Example output

export const env = {
  appName: "MyApp",
  deploymentEnv: "dev",
  publicApiBase: "/api",
} as const

Summary

Functions

Generates the env.ts contract from the exposed env values.

Functions

generate(ctx)

Generates the env.ts contract from the exposed env values.