1

I've set 2 environments for my app, a local development on my machine and the production environment on the server. I set them in bootstrap/start.phplike this:

$env = $app->detectEnvironment(array( 'ariel_dev' => array('Ariels-MacBook-Pro.local'), 'production' => array('my.server.hostname'), )); 

I've also set a folder under app/config/ariel_dev where I put the config files which I want to overwrite, like database.php.

I've test them, and they work pretty good. The problem is that my hostname changes when I'm home and when I'm at the office (I'm using a Mac). So the app doesn't match my dev environment and defaults to the production environment, connecting to the database of the server.

I'm doing something wrong? Doesn't it suppose to throw an error or something? Do I've to create a production folder under config?

Hope someone helps!

2 Answers 2

1

The default environment is always production, so you can leave it out of the array. For the other problem of having two different hostnames for you local dev, you can add them as array values of for the array local environment key.

$env = $app->detectEnvironment(array( 'ariel_dev' => array('Ariels-MacBook-Pro.local', 'myHomeHostname'), )); 
Sign up to request clarification or add additional context in comments.

Comments

0

Remember that production is also used as a fallback--it's pretty dangerous as you've configured it.

http://laravel.com/docs/configuration#environment-configuration states:

The default environment is always production

So try something like this:

$env = $app->detectEnvironment(array( 'productionserver' => array('my.server.hostname'), 'ariel_dev' => array('Ariels-MacBook-Pro.local'), )); 

and then use productionserver as the folder instead of ariel_dev

1 Comment

So, how should I configure it?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.