vendredi 11 mars 2016

laravel 5 environment configuration

I'm migrating a Laravel 4 site to 5.2, and struggling with environment configuration.

My L4 site has quite a few config files (i.e. /app/config/staging/constants.php), all of which vary according to environment: endpoint urls, 3rd party service credentials, all sorts of integration values. There's probably a couple hundred settings in all, and they way they're split across files and stored in PHP arrays makes them pretty easy to manage.

Moving these into - as I understand it - the single key-value format of an .env file is going to result in an unwieldy mess.

At the moment, I'm thinking to move my current L4 /app/config folders and files into the new L5 /config folder, and just change the way I reference them, to e.g:

$value = config(App::environment() . '.constants.some.value');

However, this strikes me as something which, if it were a good idea (and assuming it even works), would have been suggested in the docs.

So.. am I missing something here? What's the best way to manage a large number of environment-specific values in a meaningful data structure in Laravel 5?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire