The $debug and $environment variables are hardcoded in index.php. So if we
deploy this, we'll either have a web debug toolbar on production, or we'll need to
manually modify this file to set $debug to false. Both situations stink.
This library reads these values and turns S3_BUCKET and SECRET_KEY into
environment variables. Then, in our app, whenever we need some configuration -
like whether we're in debug mode, the database password or the S3 bucket -
we'll read from the environment variables. When you eventually deploy, you can set
those variables in two different ways. First, you can have a .env file. Or
second, you can set the variables via something like your web server configuration.
Some platforms - like Heroku also have a way to set environment variables. The
important point is that your app isn't bound to a configuration file: it's just
reading environment variables, which is a pretty standard way of setting config.
Remove the old variables in index.php. Replace it with $dotenv = new DotEnv\DotEnv().
The argument is the directory where the .env file lives - it's actually up one
directory from here. Then, call $dotenv->load():
Go back and refresh the new setup - we should still see the toolbar. Yep, there it
is. But now go back to .env and set SYMFONY_DEBUG to 0. Because of config.yml,
this should turn the toolbar off. Change the environment to prod too - that's not
being used anywhere yet, but it may avoid a temporary cache error: