Configuration
- Configuration Files
- Configuration Load Order
- Environment Overrides
- Environment Variables
- Default Configuration Example
Configuration Files
Sukarix is configured via .ini files by default, allowing for clear and manageable settings. The configuration load
order ensures that settings can be overridden based on the environment.
Configuration Load Order
-
Base Configuration:
config/classes.iniconfig/default.ini
-
Additional Configurations:
- Files listed in the
CONFIGSvariable, e.g.,smtp,notifications,upload. No need to add.iniextension. config/validation.ini(loaded only when a data validation request is initiated).
- Files listed in the
-
Environment-Specific Configuration:
config/config-<environment>.ini
-
Routing and Access Control:
config/routes.iniconfig/routes-<environment>.iniconfig/access.iniorconfig/access-cli.ini(based on environment).
Note
Dynamic reconfiguration
Configuration changes are automatically reloaded, meaning there is no need to restart any service.
Tip
Automatic .ini Extension Handling
When specifying additional configuration files in the
CONFIGSvariable, you do not need to include the.iniextension. Sukarix will automatically append.inito the file name during the loading process. For example, if you setCONFIGS=notifications,smtp,upload, Sukarix will loadconfig/notifications.ini,config/smtp.ini, andconfig/upload.ini.
Environment Overrides
Any configuration setting can be overridden in the environment-specific .ini file (config/config-<environment>.ini).
This allows for tailored configurations depending on whether the application is in development, testing, staging or
production.
Environment Variables
A setting that differs per host — and especially a secret — does not belong in a file that
is committed. The [environment] section declares which variable stands in for which
setting, and the framework applies them after the configuration is loaded:
[environment]
APP_SMTP_HOST = mailer.smtp.host
APP_SMTP_USERNAME = mailer.smtp.user
APP_SMTP_PASSWORD = mailer.smtp.pw
APP_DB_DSN = db.dsn
A variable that is unset or empty leaves the configured value alone, so a deployment
overrides only what it needs to and the .ini files keep working as defaults.
Tip
Where to declare the section
Put it in the file that owns the settings it maps — mail variables in
smtp.ini, database variables indefault.ini. The section is read from the merged configuration, so several files may each contribute one.
Default Configuration Example
Here is an overview of the default settings found in default.ini:
-
Global Settings:
DEBUG: Stack trace verbosity.PACKAGE: Display name in requests.LOGS: Custom log location.TEMP: Temporary folder for cache and compiled templates.UPLOADS: Directory for file uploads.UI: Paths for user interface files.LOCALES: Location of language dictionaries.ENCODING: Default character encoding.LANGUAGE: Active language.FALLBACK: Fallback language.
-
Cache and Minification:
CACHE: Cache configuration.SEED: Cache seed.MINIFY_JSandMINIFY_CSS: Toggle minification.
-
Timezone and Environment:
TZ: Timezone setting.application.environment: Current environment.log.session: Log session queries.session.table: Table for session storage.pagination.limit: Default pagination limit.template.default: Default view to render.log.keep: Log retention period.server.host: Host for command-line actions.error.channel: Error notification channel.
-
Security:
SECURITY.csrf.enabled: Enable or disable CSRF protection.SECURITY.csrf.expiry: CSRF token expiry time in seconds.SECURITY.stateless.prefixes: Route prefixes served without a session,/apiby default. See Session.api.cors.origins: Origins allowed to call a JSON API endpoint. See Building JSON APIs.
-
Logging:
log.json: Emit structured JSON log lines to stdout instead of the line-formatted log file. See Logging.
-
Mail:
mailer.smtp.timeout: Seconds to wait for the SMTP server, 2 by default.mailer.debugger_name: Name exception reports are sent under. See Emails.
-
ORM:
orm.mask_deprecations: Keeps a deprecation in Cortex from ending every request on PHP 8.5. Enabled by default; set tofalseonce Cortex is fixed.