Skip to content

Commit

Permalink
Allow APP_ENV override from $_ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Dec 14, 2023
1 parent fe09a67 commit a7effe8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ Install from a clean or exiting symfony project
1) [Install Symfony](http://symfony.com/doc/current/setup.html)
2) Follow the instructions from the [GSSP bundle](https://github.com/OpenConext/Stepup-gssp-bundle)

Setting the desired Symfony application environment
===================================================
There are 2 ways you can influence the desired Symfony application environment.

1. Set the `app_env` parameter in `config/openconext/parameters.yaml` to `dev`, `test` or `prod`
2. Override the `app_env` param by providing an environment variable named `APP_ENV`

- The default value for the application environment will be `prod`
- Do not try to use a .env file to override the `app_env` param. That file will not be evaluated by Symfony as we decided not use the DotEnv component.

Development environment
======================

Expand Down
5 changes: 5 additions & 0 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@
$_SERVER['APP_DEBUG'] = $parameters['app_debug'];
$_SERVER['APP_SECRET'] = $parameters['app_secret'];

// Allow the application environment (dev/test/prod) to change via the APP_ENV environment variable.
if (array_key_exists('APP_ENV', $_ENV)) {
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'];
}

filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
Empty file modified var/SymfonyRequirements.php
100644 → 100755
Empty file.
Empty file modified var/behat/.gitkeep
100644 → 100755
Empty file.
Empty file modified var/sessions/.gitkeep
100644 → 100755
Empty file.

0 comments on commit a7effe8

Please sign in to comment.