aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/ConfigurationLoader.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs76
1 files changed, 47 insertions, 29 deletions
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index fc3999f..52e520c 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -124,7 +124,7 @@ namespace OpenSim
124 else 124 else
125 { 125 {
126 Application.iniFilePath = Path.GetFullPath( 126 Application.iniFilePath = Path.GetFullPath(
127 Path.Combine(Util.configDir(), iniFileName)); 127 Path.Combine(Util.configDir(), iniFileName));
128 128
129 if (!File.Exists(Application.iniFilePath)) 129 if (!File.Exists(Application.iniFilePath))
130 { 130 {
@@ -139,12 +139,29 @@ namespace OpenSim
139 } 139 }
140 } 140 }
141 141
142 m_config = new OpenSimConfigSource();
143 m_config.Source = new IniConfigSource();
144 m_config.Source.Merge(DefaultConfig());
145
146 m_log.Info("[CONFIG]: Reading configuration settings");
147
148 for (int i = 0 ; i < sources.Count ; i++)
149 {
150 if (ReadConfig(m_config, sources[i]))
151 {
152 iniFileExists = true;
153 AddIncludes(m_config, sources);
154 }
155 }
156
157 // Override distro settings with contents of inidirectory
142 string iniDirName = startupConfig.GetString("inidirectory", "config"); 158 string iniDirName = startupConfig.GetString("inidirectory", "config");
143 string iniDirPath = Path.Combine(Util.configDir(), iniDirName); 159 string iniDirPath = Path.Combine(Util.configDir(), iniDirName);
144 160
145 if (Directory.Exists(iniDirPath)) 161 if (Directory.Exists(iniDirPath))
146 { 162 {
147 m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath); 163 m_log.InfoFormat("[CONFIG]: Searching folder {0} for config ini files", iniDirPath);
164 List<string> overrideSources = new List<string>();
148 165
149 string[] fileEntries = Directory.GetFiles(iniDirName); 166 string[] fileEntries = Directory.GetFiles(iniDirName);
150 foreach (string filePath in fileEntries) 167 foreach (string filePath in fileEntries)
@@ -152,33 +169,38 @@ namespace OpenSim
152 if (Path.GetExtension(filePath).ToLower() == ".ini") 169 if (Path.GetExtension(filePath).ToLower() == ".ini")
153 { 170 {
154 if (!sources.Contains(Path.GetFullPath(filePath))) 171 if (!sources.Contains(Path.GetFullPath(filePath)))
172 {
173 overrideSources.Add(Path.GetFullPath(filePath));
174 // put it in sources too, to avoid circularity
155 sources.Add(Path.GetFullPath(filePath)); 175 sources.Add(Path.GetFullPath(filePath));
176 }
156 } 177 }
157 } 178 }
158 }
159 179
160 m_config = new OpenSimConfigSource();
161 m_config.Source = new IniConfigSource();
162 m_config.Source.Merge(DefaultConfig());
163 180
164 m_log.Info("[CONFIG]: Reading configuration settings"); 181 if (overrideSources.Count > 0)
182 {
183 OpenSimConfigSource overrideConfig = new OpenSimConfigSource();
184 overrideConfig.Source = new IniConfigSource();
185
186 for (int i = 0 ; i < overrideSources.Count ; i++)
187 {
188 if (ReadConfig(overrideConfig, overrideSources[i]))
189 {
190 iniFileExists = true;
191 AddIncludes(overrideConfig, overrideSources);
192 }
193 }
194 m_config.Source.Merge(overrideConfig.Source);
195 }
196 }
165 197
166 if (sources.Count == 0) 198 if (sources.Count == 0)
167 { 199 {
168 m_log.FatalFormat("[CONFIG]: Could not load any configuration"); 200 m_log.FatalFormat("[CONFIG]: Could not load any configuration");
169 Environment.Exit(1); 201 Environment.Exit(1);
170 } 202 }
171 203 else if (!iniFileExists)
172 for (int i = 0 ; i < sources.Count ; i++)
173 {
174 if (ReadConfig(sources[i]))
175 {
176 iniFileExists = true;
177 AddIncludes(sources);
178 }
179 }
180
181 if (!iniFileExists)
182 { 204 {
183 m_log.FatalFormat("[CONFIG]: Could not load any configuration"); 205 m_log.FatalFormat("[CONFIG]: Could not load any configuration");
184 m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); 206 m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
@@ -201,9 +223,9 @@ namespace OpenSim
201 223
202 envConfigSource.LoadEnv(); 224 envConfigSource.LoadEnv();
203 m_config.Source.Merge(envConfigSource); 225 m_config.Source.Merge(envConfigSource);
204 m_config.Source.ExpandKeyValues();
205 } 226 }
206 227
228 m_config.Source.ExpandKeyValues();
207 229
208 ReadConfigSettings(); 230 ReadConfigSettings();
209 231
@@ -214,10 +236,10 @@ namespace OpenSim
214 /// Adds the included files as ini configuration files 236 /// Adds the included files as ini configuration files
215 /// </summary> 237 /// </summary>
216 /// <param name="sources">List of URL strings or filename strings</param> 238 /// <param name="sources">List of URL strings or filename strings</param>
217 private void AddIncludes(List<string> sources) 239 private void AddIncludes(OpenSimConfigSource configSource, List<string> sources)
218 { 240 {
219 //loop over config sources 241 //loop over config sources
220 foreach (IConfig config in m_config.Source.Configs) 242 foreach (IConfig config in configSource.Source.Configs)
221 { 243 {
222 // Look for Include-* in the key name 244 // Look for Include-* in the key name
223 string[] keys = config.GetKeys(); 245 string[] keys = config.GetKeys();
@@ -284,7 +306,7 @@ namespace OpenSim
284 /// </summary> 306 /// </summary>
285 /// <param name="iniPath">Full path to the ini</param> 307 /// <param name="iniPath">Full path to the ini</param>
286 /// <returns></returns> 308 /// <returns></returns>
287 private bool ReadConfig(string iniPath) 309 private bool ReadConfig(OpenSimConfigSource configSource, string iniPath)
288 { 310 {
289 bool success = false; 311 bool success = false;
290 312
@@ -292,7 +314,7 @@ namespace OpenSim
292 { 314 {
293 m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath)); 315 m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath));
294 316
295 m_config.Source.Merge(new IniConfigSource(iniPath)); 317 configSource.Source.Merge(new IniConfigSource(iniPath));
296 success = true; 318 success = true;
297 } 319 }
298 else 320 else
@@ -305,7 +327,7 @@ namespace OpenSim
305 { 327 {
306 XmlReader r = XmlReader.Create(iniPath); 328 XmlReader r = XmlReader.Create(iniPath);
307 XmlConfigSource cs = new XmlConfigSource(r); 329 XmlConfigSource cs = new XmlConfigSource(r);
308 m_config.Source.Merge(cs); 330 configSource.Source.Merge(cs);
309 331
310 success = true; 332 success = true;
311 } 333 }
@@ -337,10 +359,7 @@ namespace OpenSim
337 config.Set("physics", "OpenDynamicsEngine"); 359 config.Set("physics", "OpenDynamicsEngine");
338 config.Set("meshing", "Meshmerizer"); 360 config.Set("meshing", "Meshmerizer");
339 config.Set("physical_prim", true); 361 config.Set("physical_prim", true);
340 config.Set("see_into_this_sim_from_neighbor", true);
341 config.Set("serverside_object_permissions", true); 362 config.Set("serverside_object_permissions", true);
342 config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
343 config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
344 config.Set("storage_prim_inventories", true); 363 config.Set("storage_prim_inventories", true);
345 config.Set("startup_console_commands_file", String.Empty); 364 config.Set("startup_console_commands_file", String.Empty);
346 config.Set("shutdown_console_commands_file", String.Empty); 365 config.Set("shutdown_console_commands_file", String.Empty);
@@ -372,7 +391,6 @@ namespace OpenSim
372 { 391 {
373 m_configSettings.PhysicsEngine = startupConfig.GetString("physics"); 392 m_configSettings.PhysicsEngine = startupConfig.GetString("physics");
374 m_configSettings.MeshEngineName = startupConfig.GetString("meshing"); 393 m_configSettings.MeshEngineName = startupConfig.GetString("meshing");
375 m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
376 394
377 m_configSettings.ClientstackDll 395 m_configSettings.ClientstackDll
378 = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); 396 = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");