Environment Variables
The Azu CLI supports configuration through environment variables, providing flexibility for different deployment environments and CI/CD pipelines.
Overview
Environment variables allow you to:
Configure the CLI without modifying files
Set different configurations for different environments
Integrate with CI/CD systems
Override configuration files dynamically
Set sensitive information securely
Environment Variable Prefix
All Azu CLI environment variables use the AZU_ prefix:
AZU_CONFIG_PATH=/path/to/config
AZU_LOG_LEVEL=debug
AZU_DATABASE_URL=postgresql://user:pass@localhost/dbCore Configuration Variables
Project Configuration
AZU_CONFIG_PATH
Path to configuration file
./azu.yml
/etc/azu/config.yml
AZU_PROJECT_NAME
Default project name
Current directory name
my_awesome_app
AZU_PROJECT_VERSION
Project version
0.1.0
1.2.3
AZU_PROJECT_DESCRIPTION
Project description
Azu project
My web application
Logging Configuration
AZU_LOG_LEVEL
Logging level
info
debug, info, warn, error
AZU_LOG_FORMAT
Log format
text
text, json
AZU_LOG_FILE
Log file path
STDERR
/var/log/azu.log
AZU_LOG_COLOR
Enable colored output
true
true, false
Database Configuration
AZU_DATABASE_URL
Database connection URL
-
postgresql://user:pass@localhost/db
AZU_DATABASE_HOST
Database host
localhost
db.example.com
AZU_DATABASE_PORT
Database port
5432
3306
AZU_DATABASE_NAME
Database name
-
myapp_production
AZU_DATABASE_USER
Database username
-
myapp_user
AZU_DATABASE_PASSWORD
Database password
-
secret_password
AZU_DATABASE_POOL_SIZE
Connection pool size
5
10
AZU_DATABASE_TIMEOUT
Connection timeout (seconds)
5
10
Development Server Configuration
AZU_SERVER_HOST
Server host
localhost
0.0.0.0
AZU_SERVER_PORT
Server port
4000
8080
AZU_SERVER_WORKERS
Number of workers
1
4
AZU_SERVER_RELOAD
Enable auto-reload
true
true, false
AZU_SERVER_SSL
Enable SSL
false
true, false
AZU_SERVER_SSL_CERT
SSL certificate path
-
/path/to/cert.pem
AZU_SERVER_SSL_KEY
SSL private key path
-
/path/to/key.pem
Generator-Specific Variables
Endpoint Generator
AZU_ENDPOINT_METHODS
Default HTTP methods
index,show,new,create,edit,update,destroy
index,show,create,update,destroy
AZU_ENDPOINT_ROUTE_PREFIX
Route prefix
/
/api/v1
AZU_ENDPOINT_RESPONSE_FORMAT
Response format
json
json, html, both
AZU_ENDPOINT_AUTH_REQUIRED
Require authentication
false
true, false
AZU_ENDPOINT_AUTH_TYPE
Authentication type
session
session, token, oauth
Model Generator
AZU_MODEL_ORM
ORM framework
cql
cql, jennifer
AZU_MODEL_TABLE_NAMING
Table naming convention
snake_case
snake_case, camelCase
AZU_MODEL_MIGRATION_AUTO
Auto-generate migrations
true
true, false
AZU_MODEL_TIMESTAMPS
Include timestamps
true
true, false
AZU_MODEL_SOFT_DELETES
Include soft deletes
false
true, false
Service Generator
AZU_SERVICE_METHODS
Default service methods
create,update,destroy,find,list
create,update,destroy
AZU_SERVICE_ERROR_HANDLING
Error handling approach
exceptions
exceptions, results, both
AZU_SERVICE_TRANSACTIONS
Enable transactions
true
true, false
AZU_SERVICE_INTERFACE
Generate interfaces
true
true, false
Page Generator
AZU_PAGE_TEMPLATE_ENGINE
Template engine
jinja
jinja, ecr
AZU_PAGE_CSS_FRAMEWORK
CSS framework
bootstrap
bootstrap, tailwind
AZU_PAGE_JS_FRAMEWORK
JavaScript framework
vanilla
vanilla, alpine
AZU_PAGE_CSRF_PROTECTION
Enable CSRF protection
true
true, false
Environment-Specific Configuration
Development Environment
Production Environment
Testing Environment
Configuration Precedence
Environment variables follow this precedence order (highest to lowest):
Command-line arguments (highest priority)
Environment variables
Configuration file (
azu.yml)Default values (lowest priority)
Setting Environment Variables
Unix/Linux/macOS
Windows (Command Prompt)
Windows (PowerShell)
Environment Files
.env File
Create a .env file in your project root:
Load it in your shell:
Multiple Environment Files
Create environment-specific files:
CI/CD Integration
GitHub Actions
Docker
Security Considerations
Sensitive Information
Never commit sensitive environment variables to version control:
Environment Variable Validation
The CLI validates environment variables:
Troubleshooting
Common Issues
Variable not recognized: Ensure the variable name starts with AZU_ and is properly formatted.
Value not applied: Check the configuration precedence order and ensure no higher-priority settings override it.
Special characters: Escape special characters in values:
Debugging
Enable debug mode to see which environment variables are being used:
Environment Variable Reference
View all available environment variables:
Best Practices
Use .env files for local development
Never commit secrets to version control
Use environment-specific files for different deployment stages
Validate configuration before deployment
Document required variables in your project README
Use descriptive names for custom variables
Set sensible defaults in your configuration files
Test configuration in all environments
Last updated