[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [websites/reservoir/develop] /: new way of environment detection
From: Ingo Malchow <imalchow () kde ! org>
Date: 2014-10-28 22:46:49
Message-ID: E1XjFXN-0001Gc-HO () scm ! kde ! org
[Download RAW message or body]
Git commit bc122518b9a30756af723483f1a31110f6f300e5 by Ingo Malchow.
Committed on 28/10/2014 at 22:46.
Pushed by imalchow into branch 'develop'.
new way of environment detection
new file for domain switch, simple use of switch($_SERVER['SERVER_NAME']), overcomes issues with SetEnv
and the config itself is hidden through .gitignore.
simply copy bootstrap/environment.php.sample to bootstrap/environment.php and edit according to your needs
M +1 -0 .gitignore
A +17 -0 bootstrap/environment.php.sample
M +2 -6 bootstrap/start.php
http://commits.kde.org/websites/reservoir/bc122518b9a30756af723483f1a31110f6f300e5
diff --git a/.gitignore b/.gitignore
index d6d8670..7100c77 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ composer.phar
Thumbs.db
.directory
.project
+bootstrap/environment.php
diff --git a/bootstrap/environment.php.sample b/bootstrap/environment.php.sample
new file mode 100644
index 0000000..96bb5b2
--- /dev/null
+++ b/bootstrap/environment.php.sample
@@ -0,0 +1,17 @@
+<?php
+
+if (php_sapi_name() != 'cli') {
+
+ // Check the domain.
+ switch($_SERVER['SERVER_NAME']) {
+ case 'example.com':
+ case 'www.example.com':
+ return 'production';
+ case 'staging.example.com':
+ return 'staging';
+ case 'localhost':
+ return 'local';
+ default:
+ return 'production';
+ }
+}
diff --git a/bootstrap/start.php b/bootstrap/start.php
index 3306d94..c4d348c 100644
--- a/bootstrap/start.php
+++ b/bootstrap/start.php
@@ -24,13 +24,9 @@ $app = new Illuminate\Foundation\Application;
|
*/
-$env = $app->detectEnvironment(function()
+$env = $app->detectEnvironment(function ()
{
- if(isset($_SERVER['LARAVEL_ENV']) && "" !== $_SERVER['LARAVEL_ENV'] ) {
- return $_SERVER['LARAVEL_ENV'];
- } else {
- return 'production';
- }
+ return require __DIR__.'/environment.php';
});
/*
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic