40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
|
|
generate-env.sh — Interactively generate a .env file from a .env.example template.
|
||
|
|
|
||
|
|
Usage:
|
||
|
|
./generate-env.sh [options] [input_file]
|
||
|
|
|
||
|
|
Arguments:
|
||
|
|
input_file Path to the .env.example file (default: .env.example)
|
||
|
|
|
||
|
|
Options:
|
||
|
|
-o <file> Output file path (default: .env)
|
||
|
|
-h Show this help message
|
||
|
|
|
||
|
|
Annotation syntax in .env.example:
|
||
|
|
# Description text for the variable
|
||
|
|
# @required
|
||
|
|
# @type <type>
|
||
|
|
VAR_NAME=default_value
|
||
|
|
|
||
|
|
Supported types:
|
||
|
|
string Plain text (default when @type is absent)
|
||
|
|
number Numeric value; validated on entry
|
||
|
|
bool Boolean; prompts y/n, stored as true/false
|
||
|
|
secret Hidden input with confirmation; stored as-is
|
||
|
|
url Text; warns if value doesn't start with http(s)://
|
||
|
|
email Text; validated as user@domain.tld
|
||
|
|
enum:a,b,c Presents a numbered menu of choices
|
||
|
|
|
||
|
|
Using as a git submodule:
|
||
|
|
Add to your project:
|
||
|
|
git submodule add https://code.garrettmills.dev/garrettmills/interactive-env
|
||
|
|
|
||
|
|
Run from your project root:
|
||
|
|
./interactive-env/generate-env.sh
|
||
|
|
|
||
|
|
Update to the latest version:
|
||
|
|
git submodule update --remote interactive-env
|
||
|
|
|
||
|
|
Clone a project that uses this submodule:
|
||
|
|
git clone --recurse-submodules <your-repo-url>
|