Closed cossou closed 7 years ago
@sanderson it pulls from both sources (not sure which one has priority).
Laravel uses: https://github.com/vlucas/phpdotenv
Perfect. I had read conflicting statements about that. I should've gone straight to the source :smile:. I wonder if we should also include the default DB_
keys Laravel includes in the .env
file as fallbacks. Would this work or is the env()
function expecting a literal string as the default value?
'host' => env('DATA_DB_HOST', 'DB_HOST'),
'port' => '3306',
'database' => 'gonano',
'username' => env('DATA_DB_USER', 'DB_USERNAME'),
'password' => env('DATA_DB_PASS', 'DB_PASSWORD'),
No, that wouldn't work.
The second value passed to the env function is the "default value". This value will be used if no environment variable exists for the given key.
in https://laravel.com/docs/5.3/configuration#environment-configuration
I guess you could env('DATA_DB_USER', env('DB_USERNAME'))
but it looks ugly ðŸ˜
Since the quickstart is designed to work within the context of Nanobox, I think its fine that we don't pass in default values. The single values will always work inside Nanobox. If somebody were to use Laravel outside of Nanobox, I don't think they'd use this repo 😉 .
Thanks @cossou!
@cossou, does the
env()
helper function pull in global environment variables or only those defined in the.env
file?