Commit 1a7f31a2 authored by Romain Loth's avatar Romain Loth

using 2 chars '#;' for ini comments makes it work well both for php and python!

parent 44bde70b
[main] [main]
# that's where we'll be serving our routes for web server #; that's where we'll be serving our routes for web server
COMEX_HOST=0.0.0.0 COMEX_HOST=0.0.0.0
COMEX_PORT=9090 COMEX_PORT=9090
# that's how much we'll log from services: DEBUG,INFO,WARNING,ERROR #; that's how much we'll log from services: DEBUG,INFO,WARNING,ERROR
LOG_LEVEL=DEBUG LOG_LEVEL=DEBUG
LOG_FILE=logs/services.log LOG_FILE=logs/services.log
...@@ -12,13 +12,13 @@ PREFIX=/services ...@@ -12,13 +12,13 @@ PREFIX=/services
USR_ROUTE=/user USR_ROUTE=/user
API_ROUTE=/api API_ROUTE=/api
# NB: prefix should match your nginx/apache reverse proxy conf #; NB: prefix should match your nginx/apache reverse proxy conf
[backends] [backends]
# local address of mysql subservice for the comex_shared database #; local address of mysql subservice for the comex_shared database
SQL_HOST=172.20.0.3 SQL_HOST=172.20.0.3
SQL_PORT=3306 SQL_PORT=3306
# local or wan address of doors subservice for client authentication credentials #; local or wan address of doors subservice for client authentication credentials
DOORS_HOST=134.158.75.71 DOORS_HOST=134.158.75.71
DOORS_PORT=80 DOORS_PORT=80
...@@ -19,15 +19,19 @@ $min_num_friends=0;// nombre minimal de voisin que doit avoir un scholar pour ê ...@@ -19,15 +19,19 @@ $min_num_friends=0;// nombre minimal de voisin que doit avoir un scholar pour ê
# 1 - ENV read # 1 - ENV read
$sql_host = getenv("SQL_HOST"); $sql_host = getenv("SQL_HOST");
$dbglog = "<p>from ENV got \$sql_host=$sql_host</p>";
# 2 - INI file read # 2 - INI file read
if (empty($sql_host)) { if (empty($sql_host)) {
$params = parse_ini_file("config/parametres_comex.ini"); $params = parse_ini_file("config/parametres_comex.ini");
$sql_host = $params['SQL_HOST'] ; $sql_host = $params['SQL_HOST'] ;
$dbglog .= "<p>from INI got \$sql_host=$sql_host</p>";
} }
# 3 - default val # 3 - default val
if (empty($sql_host)) { if (empty($sql_host)) {
$sql_host = "172.17.0.2" ; $sql_host = "172.17.0.2" ;
$dbglog .= "<p>from DEF got \$sql_host=$sql_host</p>";
} }
# other sql vars # other sql vars
......
<?php <?php
include("php_library/parametres.php"); include("php_library/parametres.php");
echo "<body><p>behold the final mysql parameters<ul><li>dsn: '$dsn',</li> <li>user: '$user',</li> <li>pass: '$pass',</li> </ul></p></body>"; echo "<body><p>behold the final mysql parameters<ul><li>dsn: '$dsn',</li> <li>user: '$user',</li> <li>pass: '$pass',</li> </ul></p> $dbglog </body>";
var_dump($_ENV); var_dump($_ENV);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment