mix confispex.gen.template.envrc (confispex v1.2.0)
Generates a .envrc template file from your configuration schema for use with direnv.
The generated file contains all variables from your schema organized by groups, with helpful comments and smart defaults:
- Required variables - uncommented, ready to fill in
- Variables with defaults - commented out with their default values
- Variables with generators - uncommented with generated values (e.g., secrets)
- Optional variables - commented out
Options
--schema- (required) the module name of your schema (e.g.,MyApp.RuntimeConfigSchema)--output- (required) path to output file (e.g.,.envrcor.envrc.example)
Examples
# Generate .envrc for development
$ mix confispex.gen.template.envrc --schema=MyApp.RuntimeConfigSchema --output=.envrc
# Generate template for new developers
$ mix confispex.gen.template.envrc --schema=MyApp.RuntimeConfigSchema --output=.envrc.exampleUsage with direnv
After generating the file:
- Edit
.envrcand fill in required values - Run
direnv allowto load the environment - Variables will be automatically loaded when you enter the project directory
Safety
The task will prompt for confirmation before overwriting existing files.
Summary
Functions
Callback implementation for Mix.Task.run/1.
Functions
Callback implementation for Mix.Task.run/1.