Skip to content

Commit 71c0c01

Browse files
committed
Updated environmental config for hostname-only
1 parent 78f4615 commit 71c0c01

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,22 @@ Update the file `boostrap/start.php` under the section `Detect The Application E
5757

5858
-----
5959

60-
*IMPORTANT*: Since the initial install is done via command line (which cannot grok your apache hostname), it's important
61-
to include your machine name in the environmental array, or to pass the environmental override as a command line argument (using ` --env=local`).
62-
Otherwise, your configs will default to production (as Laravel does).
60+
__AS OF LARAVEL 4.1__
61+
Per the [Laravel 4.1 upgrade docs](http://laravel.com/docs/upgrade):
6362

64-
To find out your local machine's hostname, type `hostname` from a terminal prompt on the machine you're installing it on. If you
65-
encounter an error on your install, saying that the `driver` variable isn't defined, something got botched in your
66-
environmental settings and it's defaulting to production.
63+
__*"For security reasons, URL domains may no longer be used to detect your application environment. These values are easily spoofable and allow attackers to modify the environment for a request. You should convert your environment detection to use machine host names (hostname command on Mac & Ubuntu)."*__
6764

68-
So for example, if you're installing this locally on your Mac named SnipeMBP and with a local Apache hostname of http://snipe-it.local:8888,
69-
your environmental variable section of `bootstrap/start.php` might look like this:
65+
To find out your local machine's hostname, type `hostname` from a terminal prompt on the machine you're installing it on. The command-line response is that machine's hostname. Please note that the hostname is NOT always the same as the domain name.
7066

71-
$env = $app->detectEnvironment(array(
67+
So for example, if you're installing this locally on your Mac named SnipeMBP, the environmental variable section of `bootstrap/start.php` might look like this:
7268

73-
'local' => array('SnipeMBP','http://*.local', '*.local*', '127.0.0.1', 'localhost*'),
74-
'staging' => array('http://staging.yourserver.com'),
75-
'production' => array('http://www.yourserver.com')
69+
$env = $app->detectEnvironment(array(
70+
'local' => array('SnipeMBP'),
71+
'staging' => array('staging.mysite.com'),
72+
'production' => array('www.mysite.com')
7673
));
7774

75+
If your development, staging and production sites all run on the same server (which is generally a terrible idea), [see this example](http://words.weareloring.com/development/setting-up-multiple-environments-in-laravel-4-1/) of how to configure the app using environmental variables.
7876

7977
-----
8078

bootstrap/start.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727
$env = $app->detectEnvironment(array(
2828

29-
'local' => array('http://*.dev', 'http://*.local', '*.local*', '127.0.0.1', 'localhost*','AlisonMBP'),
30-
'staging' => array('http://staging.yourserver.com'),
31-
'production' => array('http://www.yourserver.com')
29+
'local' => array('YourLocalDevHostname','AlisonMBP'),
30+
'staging' => array('staging.yourserver.com'),
31+
'production' => array('www.yourserver.com')
3232
));
3333

3434
/*

0 commit comments

Comments
 (0)