Merge pull request #10 from radiorabe/feature/config-rewrite-airtime-saas-folder

Rewrite config from /etc/airtime-saas to plain /etc/airtime
This commit is contained in:
Lucas Bickel 2017-03-04 15:56:29 +01:00 committed by GitHub
commit 01a954481c
8 changed files with 23 additions and 18 deletions

View file

@ -114,7 +114,7 @@ define("SUBDOMAIN_WHMCS_CUSTOM_FIELD_NAME", "Choose your domain");
define('LIBRETIME_ENABLE_LIVECHAT', false);
//Sentry error logging
define('SENTRY_CONFIG_PATH', '/etc/airtime-saas/sentry.airtime_web.ini');
define('SENTRY_CONFIG_PATH', LIBRETIME_CONF_DIR . '/sentry.airtime_web.ini');
//Provisioning status
define('PROVISIONING_STATUS_SUSPENDED' , 'Suspended');

View file

@ -81,16 +81,18 @@ class Application_Model_RabbitMq
public static function getRmqConfigPath() {
//Hack for Airtime Pro. The RabbitMQ settings for communicating with airtime_analyzer are global
//and shared between all instances on Airtime Pro.
//
// todo: rewrite me to only use the config class and not access /etc/airtime directly
$CC_CONFIG = Config::getConfig();
$devEnv = "production"; //Default
if (array_key_exists("dev_env", $CC_CONFIG)) {
$devEnv = $CC_CONFIG["dev_env"];
}
$rmq_config_path = "/etc/airtime-saas/".$devEnv."/rabbitmq-analyzer.ini";
$rmq_config_path = LIBRETIME_CONF_DIR . '/' . $devEnv."/rabbitmq-analyzer.ini";
if (!file_exists($rmq_config_path)) {
// If the dev env specific rabbitmq-analyzer.ini doesn't exist default
// to the production rabbitmq-analyzer.ini
$rmq_config_path = "/etc/airtime-saas/production/rabbitmq-analyzer.ini";
$rmq_config_path = LIBRETIME_CONF_PATH . "/production/rabbitmq-analyzer.ini";
}
return $rmq_config_path;
}

View file

@ -25,8 +25,7 @@ require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcMusicDi
class MediaSetup extends Setup {
const MEDIA_FOLDER = "mediaFolder";
const AIRTIME_CONF_PATH = "/etc/airtime/airtime.conf";
const RMQ_INI_BASE_PATH = "/etc/airtime-saas/";
const LIBRETIME_CONF_FILE_NAME = "airtime.conf";
const RMQ_INI_FILE_NAME = "rabbitmq-analyzer.ini";
static $path;
@ -77,8 +76,11 @@ class MediaSetup extends Setup {
* airtime.conf to airtime.conf.tmp during the setup process. Now that we're done,
* we can rename it to airtime.conf.bak to avoid confusion.
*/
if (file_exists(self::AIRTIME_CONF_PATH . ".tmp")) {
rename(self::AIRTIME_CONF_PATH . ".tmp", self::AIRTIME_CONF_PATH . ".bak");
$fileName = LIBRETIME_CONF_DIR . '/' . self::LIBRETIME_CONF_FILE_NAME;
$tmpFile = $fileName . '.tmp';
$bakFile = $fileName . '.bak';
if (file_exists($tmpFile)) {
rename($tmpFile, $bakFile);
}
} else {
self::$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
@ -96,7 +98,7 @@ class MediaSetup extends Setup {
* @return boolean false if either of the copy or removal operations fail
*/
function moveAirtimeConfig() {
return copy(AIRTIME_CONF_TEMP_PATH, self::AIRTIME_CONF_PATH)
return copy(AIRTIME_CONF_TEMP_PATH, LIBRETIME_CONF_DIR . '/' . self::LIBRETIME_CONF_FILE_NAME)
&& unlink(AIRTIME_CONF_TEMP_PATH);
}
@ -105,8 +107,8 @@ class MediaSetup extends Setup {
* @return boolean false if either of the copy or removal operations fail
*/
function moveRmqConfig() {
return copy(RMQ_INI_TEMP_PATH, self::RMQ_INI_BASE_PATH . self::RMQ_INI_FILE_NAME)
&& copy(RMQ_INI_TEMP_PATH, self::RMQ_INI_BASE_PATH . "production/" . self::RMQ_INI_FILE_NAME)
return copy(RMQ_INI_TEMP_PATH, LIBRETIME_CONF_DIR . '/' . self::RMQ_INI_FILE_NAME)
&& copy(RMQ_INI_TEMP_PATH, LIBRETIME_CONF_DIR . '/production/' . self::RMQ_INI_FILE_NAME)
&& unlink(RMQ_INI_TEMP_PATH);
}