Commit f1252b32a4b2907d1ff1009f16c7b84d51e221bb

Authored by Benjamin Renard
1 parent 8ade06fe

Add template for environment file

.gitignore
  1 +config/current.env
1 2 .project
2 3 .idea
... ...
config/AMDAIntegrationConfig.php
1 1 <?php
2 2  
3   -$config_file=__DIR__."/my_config.env";
  3 +$config_file=__DIR__."/current.env";
4 4  
5 5 if (!file_exists($config_file)) {
  6 + //DEPRECATED - Defined for compatbility mode! For new instance, copy the template file config/current.env.template in config/current.env and replace placeholders by your own values
6 7 $localIP = exec("hostname -i");
7   -
8   - //Add your server below
9 8 switch ($localIP)
10 9 {
11   - //bas-amda-01 server (AKKA dev)
12 10 case '172.25.30.65' :
13 11 $config_file=__DIR__."/predefined_env/akka-dev.env";
14 12 break;
15   - //bas-amda-02 server (AKKA - integration)
16 13 case '10.168.220.87' :
17 14 $config_file=__DIR__."/predefined_env/akka-integration.env";
18 15 break;
... ... @@ -29,13 +26,13 @@ if (!file_exists($config_file)) {
29 26 case '192.168.83.101' :
30 27 $config_file=__DIR__."/predefined_env/akka-amdadev.env";
31 28 break;
  29 + default:
  30 + $config_file="";
32 31 }
33   -} else {
34   - $config_file="";
35 32 }
36 33  
37 34 if (empty($config_file) || !file_exists($config_file) || ($config=parse_ini_file($config_file)) == FALSE) {
38   - throw new Exception("Error to load environment config file");
  35 + throw new Exception("Error to load environment config file ".$config_file);
39 36 }
40 37  
41 38 define('COTS_BASE_DIR', $config['COTS_BASE_DIR']);
... ...
config/current.env.template 0 โ†’ 100644
... ... @@ -0,0 +1,18 @@
  1 +;This is a template file.
  2 +;Copy this file in php/my_config.php and replace all placeholders - included between {: and :} flags - by your own values
  3 +
  4 +;Path to COTS dir
  5 +COTS_BASE_DIR='{:COTS_BASE_DIR:}'
  6 +
  7 +;Path to tools dir
  8 +TOOLS_BASE_DIR='{:TOOLS_BASE_DIR:}'
  9 +
  10 +;Define kernel build type
  11 +KERNEL_BUILD_TYPE='{:KERNEL_BUILD_TYPE:}'
  12 +
  13 +;Path to AMDA_Kernel base dir
  14 +AMDA_KERNEL_DIR='{:AMDA_KERNEL_DIR:}'
  15 +
  16 +;Path to AMDA_IHM base dir
  17 +IHM_SRC_DIR='{:IHM_SRC_DIR:}'
  18 +
... ...
src/InputOutput/IHMImpl/Config/IHMConfigClass.php
... ... @@ -84,7 +84,7 @@ class IHMConfigClass
84 84  
85 85 public static function getUserPath()
86 86 {
87   - $userPath = IHM_SRC_DIR.self::$dataDir.self::$userName.'/';
  87 + $userPath = IHM_SRC_DIR.'/'.self::$dataDir.self::$userName.'/';
88 88  
89 89 if (!is_dir($userPath))
90 90 mkdir($userPath);
... ... @@ -94,22 +94,22 @@ class IHMConfigClass
94 94  
95 95 public static function getProcessManagerFilePath()
96 96 {
97   - return IHM_SRC_DIR.self::$dataDir.self::$processMgrFile;
  97 + return IHM_SRC_DIR.'/'.self::$dataDir.self::$processMgrFile;
98 98 }
99 99  
100 100 public static function getConstantsFilePath()
101 101 {
102   - return IHM_SRC_DIR.self::$genericDataDir.self::$functionsDir.self::$constantsFile;
  102 + return IHM_SRC_DIR.'/'.self::$genericDataDir.self::$functionsDir.self::$constantsFile;
103 103 }
104 104  
105 105 public static function getFunctionsFilePath()
106 106 {
107   - return IHM_SRC_DIR.self::$genericDataDir.self::$functionsDir.self::$functionsFile;
  107 + return IHM_SRC_DIR.'/'.self::$genericDataDir.self::$functionsDir.self::$functionsFile;
108 108 }
109 109  
110 110 public static function getParamTemplateFilePath($fileName)
111 111 {
112   - return IHM_SRC_DIR.self::$genericDataDir.self::$paramTemplateDir.$fileName.".xml";
  112 + return IHM_SRC_DIR.'/'.self::$genericDataDir.self::$paramTemplateDir.$fileName.".xml";
113 113 }
114 114  
115 115 public static function getTemplateParamGeneratePath()
... ... @@ -124,7 +124,7 @@ class IHMConfigClass
124 124  
125 125 public static function getParamTemplateListFilePath()
126 126 {
127   - return IHM_SRC_DIR.self::$genericDataDir.self::$paramTemplateDir.self::$paramTemplateFile;
  127 + return IHM_SRC_DIR.'/'.self::$genericDataDir.self::$paramTemplateDir.self::$paramTemplateFile;
128 128 }
129 129  
130 130 public static function getUserParamManagerFilePath()
... ... @@ -154,7 +154,7 @@ class IHMConfigClass
154 154  
155 155 public static function getSharedPath()
156 156 {
157   - return IHM_SRC_DIR.self::$sharedDir;
  157 + return IHM_SRC_DIR.'/'.self::$sharedDir;
158 158 }
159 159  
160 160 public static function getSharedTreeFilePath()
... ... @@ -238,7 +238,7 @@ class IHMConfigClass
238 238  
239 239 public static function getRemoteDataPath()
240 240 {
241   - $remoteDataPath = IHM_SRC_DIR.self::$genericDataDir.self::$remoteDataDir;
  241 + $remoteDataPath = IHM_SRC_DIR.'/'.self::$genericDataDir.self::$remoteDataDir;
242 242  
243 243 return $remoteDataPath;
244 244 }
... ...
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... ... @@ -133,12 +133,12 @@ class IHMParamManagerClass
133 133 if ($this->templateParamsManager->isTemplatedParam($paramId)) {
134 134 $paramPath = $this->templateParamsManager->getTemplatePath($paramId);
135 135 if (empty($paramPath) || !@$doc->load($paramPath))
136   - throw new Exception('Cannot find parameter template file '.$paramPath);
  136 + throw new Exception('Cannot find parameter template file '.$paramId);
137 137 }
138 138 else {
139 139 $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml";
140 140 if (empty($paramPath) || !@$doc->load($paramPath))
141   - throw new Exception('Cannot find parameter local file '.$paramPath);
  141 + throw new Exception('Cannot find parameter local file '.$paramId);
142 142 }
143 143  
144 144 //<get>
... ...
src/RequestManager.php
... ... @@ -31,8 +31,8 @@ function amdaintegration_autoload($class_name)
31 31 );
32 32  
33 33 $ihm_dirs = array(
34   - IHM_SRC_DIR.'php/classes',
35   - IHM_SRC_DIR.'php/RemoteDataCenter'
  34 + IHM_SRC_DIR.'/php/classes',
  35 + IHM_SRC_DIR.'/php/RemoteDataCenter'
36 36 );
37 37  
38 38 $find = false;
... ...
src/amdaintegration_autoload.php
... ... @@ -30,8 +30,8 @@ function amdaintegration_autoload($class_name)
30 30 );
31 31  
32 32 $ihm_dirs = array(
33   - IHM_SRC_DIR.'php/classes',
34   - IHM_SRC_DIR.'php/RemoteDataCenter'
  33 + IHM_SRC_DIR.'/php/classes',
  34 + IHM_SRC_DIR.'/php/RemoteDataCenter'
35 35 );
36 36  
37 37 $find = false;
... ...