Configuration Guide
Configure your EZ-Console application using YAML files, environment variables, or command-line flags.
Configuration File
Create config.yaml:
server:
host: "0.0.0.0"
port: 8080
mode: "debug" # debug or release
read_timeout: 10s
write_timeout: 10s
database:
driver: "sqlite" # sqlite, mysql, postgres
path: "./app.db"
# For MySQL/PostgreSQL:
# host: "localhost"
# port: 3306
# username: "dbuser"
# password: "dbpass"
# dbname: "myapp"
log:
level: "info" # debug, info, warn, error
format: "json" # json or logfmt
global:
encrypt_key: "16-byte-key-here" # IMPORTANT: Do not commit!
Environment Variables
Override config with environment variables:
export SERVER_PORT=9090
export DATABASE_DRIVER=mysql
export DATABASE_HOST=localhost
export DATABASE_USERNAME=root
export DATABASE_PASSWORD=secret
export LOG_LEVEL=debug
export GLOBAL_ENCRYPT_KEY=your-secret-key
Command-Line Flags
Override with flags:
./server \
--global.encrypt-key=your-key \
--server.port=9090 \
--database.driver=mysql \
--database.host=db.example.com \
--log.level=debug \
--config config.yaml
Configuration Priority
- Command-line flags (highest)
- Environment variables
- Configuration file
- Default values (lowest)
Encryption Key
The global.encrypt_key is used to encrypt sensitive data in the database.
Requirements:
- Must be 8, 16, 24, or 32 bytes
- Never change after initial setup
- Never commit to version control
- Use environment variable in production
Generate secure key:
openssl rand -base64 32 | cut -c1-16
Production Configuration
server:
host: "0.0.0.0"
port: 8080
mode: "release"
database:
driver: "postgres"
host: "${DB_HOST}"
port: 5432
username: "${DB_USER}"
password: "${DB_PASSWORD}"
dbname: "production_db"
max_open_conns: 100
max_idle_conns: 10
log:
level: "info"
format: "json"
global:
encrypt_key: "${ENCRYPT_KEY}"
Next Steps
- Configure database
- Set up security
- Configure email
- Set up OAuth/LDAP