Application config
Application config is everything that is likely to vary between deployments of the same application (staging, production, developer environments, etc.), such as database credentials, API keys, and other environment-specific settings.
The Twelve-Factor principles states that an app's config should be managed and stored separately from code. This pattern allows a single codebase to be shared between deploys and helps to keep sensitive information outside of version control. It also becomes easy to make configuration changes without re-deploying the app.
On Magelify, app config is managed through environment variables and config files which gets injected into containers at runtime.
Environment variables
Environment variables are arbitrary key-value pairs of information that alters the behavior of the application in some way. Most programming languages and operating systems has built-in support for environment variables, offering easy ways to read and consume them from your applications.
Magelify maintains a set of environment variables for each environment, which can be managed from the Dashboard > Site > Settings tab. When you make a change to the environment variables the targeted deployment are reloaded immediately to reflect the updates.
Some variables are created automatically by the application framework template that were used to provision the site. Required variables are identified by a padlock icon next to the name and cannot be deleted.
You can find a list of supported environment variables under each framework's documentation.
Configuration files
Configuration files are arbitrary text files that are mounted into the application container at runtime. Config files can be used to store application settings and other information that should be stored separately from the application code. Configuration files are read-only inside the container and are either generated automatically or managed through the web UI.
Examples include custom NGINX and PHP config, and site-specific config such as the Wordpress wp-config.php
or Magento multi-store config.
When a site is deployed, Magelify generates required configuration files based on information it obtains from the runtime environment. This includes things like database credentials and whether or not particular addons are enabled.
This allows for the staging deployment to use a different database than production, and so forth.
The following application config is managed automatically by the platform:
Application/framework | Config file(s) |
---|---|
Magento | app/etc/env.php (Magento 2) app/etc/local.xml (M1/OpenMage) |
Wordpress | wp-config.php |
Drupal | settings.php and settings.env.php |