Commit 10aaf3d8 authored by Nick Sellen's avatar Nick Sellen

Add environment switching config.inc.php

Uses FS_ENV environment variable to choose which config file to
load based on the pattern "config.inc.<env>.php"

Added config.inc.dev.php and config.inc.test.php files.
parent f7a4da87
<?php
$protocol = 'http';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
{
$protocol = 'https';
}
define('PROTOCOL',$protocol);
define('DB_HOST','db');
define('DB_USER','root');
define('DB_PASS','root');
define('DB_DB','foodsharing');
define('PREFIX','fs_');
define('ERROR_REPORT',E_ALL);
define('BASE_URL', $protocol . '//lmr.local/');
define('URL_INTERN',$protocol . '://lmr.local/freiwillige/');
define('DEFAULT_EMAIL','noreply@lebensmittelretten.de');
define('DEFAULT_EMAIL_NAME','Foodsharing Freiwillige');
define('VERSION','0.8.1');
define('EMAIL_PUBLIC', 'info@lebensmittelretten.de');
define('EMAIL_PUBLIC_NAME','Foodsharing Freiwillige');
define('DEFAULT_HOST','lebensmittelretten.de');
define('API_ID','c1d9a69515d63194b4329a5359a4c40a'); // foodsharing api key
define('SMTP_HOST','');
define('SMTP_USER','');
define('SMTP_PASS','');
define('SMTP_PORT',25);
define('MEM_ENABLED', true);
define('REDIS_HOST', 'redis');
define('REDIS_PORT', 6379);
if(!defined('ROOT_DIR'))
{
define('ROOT_DIR','./');
}
<?php
# TODO: sanitize env name
# TODO: maybe have a default env?
# TODO: check if there is not already a concept of app environment elsewhere
$FS_ENV= getenv('FS_ENV');
$env_filename = 'config.inc.'.$FS_ENV.'.php';
if (file_exists($env_filename)) {
require_once $env_filename;
} else {
die('no config found for env ['.$FS_ENV.']');
}
<?php
$protocol = 'http';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
{
$protocol = 'https';
}
define('PROTOCOL',$protocol);
define('DB_HOST','db');
define('DB_USER','root');
define('DB_PASS','root');
define('DB_DB','foodsharing');
define('PREFIX','fs_');
define('ERROR_REPORT',E_ALL);
define('BASE_URL', $protocol . '//lmr.local/');
define('URL_INTERN',$protocol . '://lmr.local/freiwillige/');
define('DEFAULT_EMAIL','noreply@lebensmittelretten.de');
define('DEFAULT_EMAIL_NAME','Foodsharing Freiwillige');
define('VERSION','0.8.1');
define('EMAIL_PUBLIC', 'info@lebensmittelretten.de');
define('EMAIL_PUBLIC_NAME','Foodsharing Freiwillige');
define('DEFAULT_HOST','lebensmittelretten.de');
define('API_ID','c1d9a69515d63194b4329a5359a4c40a'); // foodsharing api key
define('SMTP_HOST','');
define('SMTP_USER','');
define('SMTP_PASS','');
define('SMTP_PORT',25);
define('MEM_ENABLED', true);
define('REDIS_HOST', 'redis');
define('REDIS_PORT', 6379);
if(!defined('ROOT_DIR'))
{
define('ROOT_DIR','./');
}
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