File: /var/www/limestate-api/config.php
<?php
if (php_sapi_name() == "cli") {
if (isset($argv)) {
foreach ($argv as $arg) {
if (in_array($arg, ['development', 'temp'])) {
define('APP_ENV', $arg);
}
}
if (!defined('APP_ENV')) {
define('APP_ENV', 'production');
}
}
} else {
define('APP_ENV', empty(getenv('APPLICATION_ENV')) ? 'production' : getenv('APPLICATION_ENV'));
}
$CFG = new StdClass();
switch (APP_ENV) {
case 'development':
$CFG->db['write'] = [
'database' => "limeapi_production",
'host' => "mysql",
'port' => "3306",
'username' => "root",
'password' => "root",
//'socket' => "/tmp/mysql.sock",
'charset' => "utf8mb4",
];
define('ELASTIC', 'elastic:9200');
define('DEBUG', true);
define('BITRIX_CALL_ENABLED', true);
define('ADMIN_HOST', 'https://limestate-admin.foach.site');
break;
case 'test':
$CFG->db['write'] = [
'database' => "limestate_admin",
'host' => "localhost",
'username' => "quad",
'password' => "quad",
'charset' => "utf8mb4",
];
define('ELASTIC', 'localhost:9200');
define('DEBUG', true);
define('BITRIX_CALL_ENABLED', true);
define('ADMIN_HOST', 'https://limestate-admin.foach.site');
break;
case 'production':
default:
$CFG->db['write'] = [
'database' => "limeapi_production",
'host' => "localhost",
'username' => "lime",
'password' => 'R:H4*Bft7#%re$r7',
'charset' => "utf8mb4",
];
define('ELASTIC', '84.201.165.2:9200');
define('DEBUG', false);
define('BITRIX_CALL_ENABLED', false);
define('ADMIN_HOST', 'https://admin.limestate.ru');
break;
}
$CFG->db['read'] = $CFG->db['write'];
$CFG->temp_db['read'] = $CFG->db['read'];
$CFG->temp_db['read']['database'] = "limeapi_migration";
$CFG->temp_db['write'] = $CFG->temp_db['read'];
$CFG->debug = DEBUG;