[Fusionforge-commits] r14685 - in trunk: . src/common/include

Roland Mas lolando at fusionforge.org
Fri Oct 21 16:51:07 CEST 2011


Author: lolando
Date: 2011-10-21 16:51:07 +0200 (Fri, 21 Oct 2011)
New Revision: 14685

Modified:
   trunk/
   trunk/src/common/include/pre.php
Log:
Don't ignore config items coming from the environment or the Apache headers

Modified: trunk/src/common/include/pre.php
===================================================================
--- trunk/src/common/include/pre.php	2011-10-19 16:42:05 UTC (rev 14684)
+++ trunk/src/common/include/pre.php	2011-10-21 14:51:07 UTC (rev 14685)
@@ -55,7 +55,7 @@
 }
 
 // Database access and other passwords when on the web
-function setconfigfromoldsources ($sec, $var, $serv, $env, $glob) {
+function setconfigfromenv ($sec, $var, $serv, $env) {
 	if (getenv ('SERVER_SOFTWARE')) {
 		if (function_exists ('apache_request_headers')) {
 			$headers = apache_request_headers() ;
@@ -66,19 +66,27 @@
 		if (isset ($headers[$serv])) {
 			forge_define_config_item ($var, $sec,
 						  $headers[$serv]) ;
-			return ;
+			return true;
 		}
 	}
 	if (isset ($_ENV[$env])) {
 		forge_define_config_item ($var, $sec,
 					  getenv($env)) ;
-		return ;
+		return true;
 	}
+	return false;
+}
+
+function setconfigfromoldsources ($sec, $var, $serv, $env, $glob) {
+	if (setconfigfromenv($sec, $var, $serv, $env)) {
+		return true;
+	}
 	if (isset ($GLOBALS[$glob])) {
 		forge_define_config_item ($var, $sec,
 					  $GLOBALS[$glob]) ;
-		return ;
+		return true;
 	}
+	return false;
 }
 
 if (isset($gfcgfile) && file_exists ($gfcgfile)) {
@@ -105,6 +113,21 @@
 	forge_define_config_item ('config_path', 'core', '/etc/gforge') ;
 
 	require_once $gfcommon.'include/config-vars.php';
+} else {
+	setconfigfromenv ('core', 'database_host',
+				 'GForgeDbhost', 'sys_gfdbhost') ;
+	setconfigfromenv ('core', 'database_port',
+				 'GForgeDbport', 'sys_gfdbport') ;
+	setconfigfromenv ('core', 'database_name',
+				 'GForgeDbname', 'sys_gfdbname') ;
+	setconfigfromenv ('core', 'database_user',
+				 'GForgeDbuser', 'sys_gfdbuser') ;
+	setconfigfromenv ('core', 'database_password',
+				 'GForgeDbpasswd', 'sys_gfdbpasswd') ;
+	setconfigfromenv ('core', 'ldap_password',
+				 'GForgeLdapPasswd', 'sys_gfldap_passwd') ;
+	setconfigfromenv ('core', 'jabber_password',
+				 'GForgeJabberPasswd', 'sys_gfjabber_pass') ;
 }
 
 forge_read_config_file ($gfconfig.'/config.ini') ;




More information about the Fusionforge-commits mailing list