Configuration
Azu configuration properties are minimal this is to help you keep everything in a mental model without overloading your brain.
Overview
Azu configuration properties are minimal this is to help you keep everything in a mental model without overloading your brain.
Configuration properties lives within your application's main file.
Configuration Properties
Apps sometimes store config as constants in the code. This is a violation of the twelve-factor, which requires strict separation of config from code. Config varies substantially across deploys, code does not.
Azu follows the https://12factor.net/config standards this is why Azu first attempts to load configuration values from the environment first if not found then it loads from code.
We recommend for development use .env files.
.env
file.env.local
file.env.#{CRYSTAL_ENV}
file.env.#{CRYSTAL_ENV}.local
file
Important: Azu does NOT load the .env
files automatically. It is up to you the developer to use your preferred method to load environment variables.
Configuration
Environment Variables
Default Value
port
PORT
4000
jj port_reuse
PORT_REUSE
true
host
HOST
"0.0.0.0"
log
CRYSTAL_LOG_LEVEL, CRYSTAL_LOG_SOURCES
Log.for("Azu")
env
CRYSTAL_ENV
Environment::Development
template.path
TEMPLATES_PATH
"./templates"
template.error_path
ERROR_TEMPLATE
"./error_template"
ssl_cert
SSL_CERT
""
ssl_key
SSL_KEY
""
ssl_ca
SSL_MODE
""
ssl_mode
SSL_CA
"none"
Example
App Environments
By default Azu ships with the following environments:
Build
Development
Test
Integration
Acceptance
Pipeline
Staging
Production
The current application environment is determined via the CRYSTAL_ENV variable.
Use the following method to determine or compare environments
Middlewares
Finally, you must know how to start the server.
Last updated