Skip to content

Commit

Permalink
[Added] Added the env variable to general.php, accessible via `{{…
Browse files Browse the repository at this point in the history
… craft.config.env }}`
  • Loading branch information
khalwat committed Nov 9, 2016
1 parent 6fc825b commit e58ae10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ By convention, all CME settings should be prefixed with `CRAFTENV_` for semantic

You should also update the `example.env.php` to include any settings you add, for reference.

### Accessing the settings in `general.php`

You can access any variables defined in the `general.php` file in Twig via `{{ craft.config }}`. e.g.:

{% if craft.config.env == "local" %}
{% endif %}

### Production via webserver config

It's perfectly fine to use CME as discussed above in a production environment. However, if you want an added measure of security and performance, you can set up your webserver to set the same globally accessible settings via webserver config.
Expand Down Expand Up @@ -121,6 +128,11 @@ Inside the `server {}` or `location ~ \.php {}` block or in the `fastcgi_params`

## Craft-Multi-Environment Changelog

### 1.0.2 -- 2016.11.09

* [Added] Added the `env` variable to `general.php`, accessible via `{{ craft.config.env }}`
* [Improved] Updated README.md

### 1.0.1 -- 2016.11.02

* [Added] Added support for `CRAFTENV_SITE_URL`
Expand Down
1 change: 1 addition & 0 deletions craft/config/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'useEmailAsUsername' => true,
'generateTransformsBeforePageLoad' => true,
'siteUrl' => getenv('CRAFTENV_SITE_URL'),
'env' => CRAFT_ENVIRONMENT,

// Set the environmental variables
'environmentVariables' => array(
Expand Down

0 comments on commit e58ae10

Please sign in to comment.