I have the following setup with Laravel 4.2:
bootstrap/start.php (hostname correct, environment is local)
$env = $app->detectEnvironment(array(
'production' => array('produrl'),
'local' => array('MBP-Ivo.local', 'iMac-Ivo.local'),
));
.env.local.php (in project root, .env.php is exactly the same except mysql info)
<?php
return [
// Code variables
'mysqlUsername' => 'user',
'mysqlPassword' => 'password',
'mysqlDatabase' => 'database',
'paymentIdeal' => false,
'shipmentCountries' => [
'Nederland' => 'Nederland',
'Belgie' => 'Belgie'
]
];
config/app.php (I don't overwrite with app/config/local/app.php)
<?php
return array(
'paymentIdeal' => $_ENV['paymentIdeal'],
'shipmentCountries' => $_ENV['shipmentCountries']
);
There are some more variables, but the problem is with shipmentCountries.
Undefined index: shipmentCountries
All variables declared are working (eg paymentIdeal), but shipmentCountries gives an error. I think because it's an array? The name is exactly the same everywhere, including capital letters.
Does anyone know why I can't get this working?
BTW: I'm choosing this option to prevent users having to change their application configs. I want to use only one *.env file to configure all important stuff. And yes, I know these values could be saved to the database, but that's for later :)
/edit: When I dump the $_ENV, I get the following:
Array
(
[mysqlUsername] => ***
[mysqlPassword] => ***
[mysqlDatabase] => ***
[paymentIdeal] =>
[shipmentCountries.Nederland] => Nederland
[shipmentCountries.Belgie] => Belgie
);
Somehow it "flattens" the array shipmentCountries. Anyone knows how and why?
var_dump
of$_ENV
show? – lukasgeiter