SAAS-560: Deploy separate cloud storage config files for each development environment
This commit is contained in:
parent
93da48351c
commit
5040eb498d
|
@ -25,19 +25,6 @@ class Config {
|
||||||
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse separate conf file for cloud storage values
|
|
||||||
$cloudStorageConfig = isset($_SERVER['CLOUD_STORAGE_CONF']) ? $_SERVER['CLOUD_STORAGE_CONF'] : "/etc/airtime-saas/cloud_storage.conf";
|
|
||||||
$cloudStorageValues = parse_ini_file($cloudStorageConfig, true);
|
|
||||||
|
|
||||||
$CC_CONFIG["supportedStorageBackends"] = array('amazon_S3');
|
|
||||||
foreach ($CC_CONFIG["supportedStorageBackends"] as $backend) {
|
|
||||||
$CC_CONFIG[$backend] = $cloudStorageValues[$backend];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tells us where file uploads will be uploaded to.
|
|
||||||
// It will either be set to a cloud storage backend or local file storage.
|
|
||||||
$CC_CONFIG["current_backend"] = $cloudStorageValues["current_backend"]["storage_backend"];
|
|
||||||
|
|
||||||
$values = parse_ini_file($filename, true);
|
$values = parse_ini_file($filename, true);
|
||||||
|
|
||||||
// Name of the web server user
|
// Name of the web server user
|
||||||
|
@ -54,6 +41,19 @@ class Config {
|
||||||
$CC_CONFIG['dev_env'] = 'production';
|
$CC_CONFIG['dev_env'] = 'production';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse separate conf file for cloud storage values
|
||||||
|
$cloudStorageConfig = "/etc/airtime-saas/".$CC_CONFIG['dev_env']."/cloud_storage_".$CC_CONFIG['dev_env'].".conf";
|
||||||
|
$cloudStorageValues = parse_ini_file($cloudStorageConfig, true);
|
||||||
|
|
||||||
|
$CC_CONFIG["supportedStorageBackends"] = array('amazon_S3');
|
||||||
|
foreach ($CC_CONFIG["supportedStorageBackends"] as $backend) {
|
||||||
|
$CC_CONFIG[$backend] = $cloudStorageValues[$backend];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tells us where file uploads will be uploaded to.
|
||||||
|
// It will either be set to a cloud storage backend or local file storage.
|
||||||
|
$CC_CONFIG["current_backend"] = $cloudStorageValues["current_backend"]["storage_backend"];
|
||||||
|
|
||||||
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
|
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
|
||||||
|
|
||||||
$CC_CONFIG['monit_user'] = $values['monit']['monit_user'];
|
$CC_CONFIG['monit_user'] = $values['monit']['monit_user'];
|
||||||
|
|
|
@ -89,7 +89,7 @@ class Application_Model_RabbitMq
|
||||||
if (array_key_exists("dev_env", $CC_CONFIG)) {
|
if (array_key_exists("dev_env", $CC_CONFIG)) {
|
||||||
$devEnv = $CC_CONFIG["dev_env"];
|
$devEnv = $CC_CONFIG["dev_env"];
|
||||||
}
|
}
|
||||||
$config = parse_ini_file("/etc/airtime-saas/rabbitmq-analyzer-" . $devEnv . ".ini", true);
|
$config = parse_ini_file("/etc/airtime-saas/".$devEnv."/rabbitmq-analyzer-" . $devEnv . ".ini", true);
|
||||||
$conn = new AMQPConnection($config["rabbitmq"]["host"],
|
$conn = new AMQPConnection($config["rabbitmq"]["host"],
|
||||||
$config["rabbitmq"]["port"],
|
$config["rabbitmq"]["port"],
|
||||||
$config["rabbitmq"]["user"],
|
$config["rabbitmq"]["user"],
|
||||||
|
|
|
@ -5,8 +5,7 @@ import config_file
|
||||||
from boto.s3.connection import S3Connection
|
from boto.s3.connection import S3Connection
|
||||||
from boto.s3.key import Key
|
from boto.s3.key import Key
|
||||||
|
|
||||||
|
AIRTIME_CONFIG_PATH = '/etc/airtime/airtime.conf'
|
||||||
CLOUD_CONFIG_PATH = '/etc/airtime-saas/cloud_storage.conf'
|
|
||||||
STORAGE_BACKEND_FILE = "file"
|
STORAGE_BACKEND_FILE = "file"
|
||||||
|
|
||||||
class CloudStorageUploader:
|
class CloudStorageUploader:
|
||||||
|
@ -25,6 +24,13 @@ class CloudStorageUploader:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
|
airtime_config = config_file.read_config_file(AIRTIME_CONFIG_PATH)
|
||||||
|
dev_env = "production" # Default
|
||||||
|
if airtime_config.has_option("general", "dev_env"):
|
||||||
|
dev_env = airtime_config.get("general", "dev_env")
|
||||||
|
|
||||||
|
|
||||||
|
CLOUD_CONFIG_PATH = "/etc/airtime-saas/%s/cloud_storage_%s.conf" % (dev_env, dev_env)
|
||||||
config = config_file.read_config_file(CLOUD_CONFIG_PATH)
|
config = config_file.read_config_file(CLOUD_CONFIG_PATH)
|
||||||
|
|
||||||
CLOUD_STORAGE_CONFIG_SECTION = config.get("current_backend", "storage_backend")
|
CLOUD_STORAGE_CONFIG_SECTION = config.get("current_backend", "storage_backend")
|
||||||
|
|
Loading…
Reference in New Issue