marg
Meta config for apps from args Use to connect to DB to pull other configs
support external app execution (az acc) for a password (token) acquisition
ArgConfig
Parses app startup arguments into a structured config.
Priority order:
- command-line args:
- prefixed with --name
- positional or heuristic
- environment variables
- config file.
Arguments
Arguments can be passed positionally (auto-detected by format) or with explicit --flag value prefixes:
| Flag | Positional detection | Description | Default |
|---|---|---|---|
--db |
URL prefix (e.g. postgres://) |
Database connection URL | postgres:// with current $USER |
--config |
schema.table format (contains .) |
Config table name | public.<appname> |
--uuid |
UUID-formatted string | Node/instance ID | Auto-generated (see uuid_gen) |
--token |
3rd unmatched arg | Script name to acquire DB password | (none) |
--ttl |
Numeric string | Token lifetime in minutes | 1 |
--key |
(explicit only) | RSA/AES private key file path (feature rsa) |
(none) |
--secret |
(explicit only) | AES cipher secret (prefer env SECRET) |
(none) |
--file |
(explicit only) | Config file to load key=value pairs from | (none) |
Environment Variables
PGPASSWORD— PostgreSQL password (used to connect to DB)PASSPHRASE— Passphrase for RSA private keySECRET— AES cipher secret; removed from env after reading (unless compiled withkeep_env_secretfeature)$USER— Substituted into DB URL where$USERappears
Config File Format
Lines parsed as key: value or key= value. Blank lines and lines starting with #, ;, /, [ are ignored.
db: postgres://host/dbname
config: myschema.settings
uuid: 550e8400-e29b-41d4-a716-446655440000
token: get-token.sh
ttl: 15
pk: /path/to/private.key
Fields
Usage
let config = from_args?;
let url = config.db_url; // resolves $PWD placeholder with token value