conf.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /* THIS FILE IS NOT MEANT FOR CUSTOMIZING.
  3. * PLEASE EDIT THE FOLLOWING TO CHANGE YOUR CONFIG:
  4. * /etc/airtime/airtime.conf
  5. */
  6. class Config {
  7. private static $CC_CONFIG = null;
  8. public static function loadConfig() {
  9. $CC_CONFIG = array(
  10. /* ================================================ storage configuration */
  11. 'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
  12. 'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
  13. "rootDir" => __DIR__."/../.."
  14. );
  15. //In the unit testing environment, we always want to use our local airtime.conf in airtime_mvc/application/test:
  16. if (getenv('AIRTIME_UNIT_TEST') == '1') {
  17. $filename = "airtime.conf";
  18. } else {
  19. $filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
  20. }
  21. $values = parse_ini_file($filename, true);
  22. // Name of the web server user
  23. $CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
  24. $CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
  25. $CC_CONFIG['baseDir'] = $values['general']['base_dir'];
  26. $CC_CONFIG['baseUrl'] = $values['general']['base_url'];
  27. $CC_CONFIG['basePort'] = $values['general']['base_port'];
  28. // $CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
  29. $CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
  30. // Database config
  31. $CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
  32. $CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
  33. $CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
  34. $CC_CONFIG['dsn']['phptype'] = 'pgsql';
  35. $CC_CONFIG['dsn']['database'] = $values['database']['dbname'];
  36. $CC_CONFIG['apiKey'] = array($values['general']['api_key']);
  37. if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development"){
  38. $CC_CONFIG['apiKey'][] = "";
  39. }
  40. $CC_CONFIG['soundcloud-connection-retries'] = $values['soundcloud']['connection_retries'];
  41. $CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_retries'];
  42. if(isset($values['demo']['demo'])){
  43. $CC_CONFIG['demo'] = $values['demo']['demo'];
  44. }
  45. self::$CC_CONFIG = $CC_CONFIG;
  46. }
  47. public static function setAirtimeVersion() {
  48. $airtime_version = Application_Model_Preference::GetAirtimeVersion();
  49. $uniqueid = Application_Model_Preference::GetUniqueId();
  50. self::$CC_CONFIG['airtime_version'] = md5($airtime_version.$uniqueid);
  51. }
  52. public static function getConfig() {
  53. if (is_null(self::$CC_CONFIG)) {
  54. self::loadConfig();
  55. }
  56. return self::$CC_CONFIG;
  57. }
  58. }