diff options
As per the suggestion on the mailing list, added support for a OpenSim.xml config file, instead of a ini file. INI files still work the same as they did before, just now if a ini file isn't found, it looks for a OpenSim.xml file (of course in xml format) and if found uses that.
Includes a OpenSim.Example.xml for reference (the default settings saved as a xml file).
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 74 |
1 files changed, 55 insertions, 19 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f205686..255a125 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -107,9 +107,10 @@ namespace OpenSim | |||
107 | 107 | ||
108 | protected IConfigSource m_finalConfig = null; | 108 | protected IConfigSource m_finalConfig = null; |
109 | 109 | ||
110 | protected IniConfigSource m_config; | 110 | //protected IniConfigSource m_config; |
111 | protected OpenSimConfigSource m_config; | ||
111 | 112 | ||
112 | public IniConfigSource ConfigSource | 113 | public OpenSimConfigSource ConfigSource |
113 | { | 114 | { |
114 | get { return m_config; } | 115 | get { return m_config; } |
115 | set { m_config = value; } | 116 | set { m_config = value; } |
@@ -168,27 +169,43 @@ namespace OpenSim | |||
168 | 169 | ||
169 | Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini"); | 170 | Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini"); |
170 | 171 | ||
171 | m_config = new IniConfigSource(); | 172 | m_config = new OpenSimConfigSource(); |
173 | m_config.ConfigSource = new IniConfigSource(); | ||
174 | IConfigSource icong; | ||
175 | |||
172 | //check for .INI file (either default or name passed in command line) | 176 | //check for .INI file (either default or name passed in command line) |
173 | if (File.Exists(Application.iniFilePath)) | 177 | if (File.Exists(Application.iniFilePath)) |
174 | { | 178 | { |
175 | m_config.Merge(new IniConfigSource(Application.iniFilePath)); | 179 | m_config.ConfigSource.Merge(new IniConfigSource(Application.iniFilePath)); |
176 | m_config.Merge(configSource); | 180 | m_config.ConfigSource.Merge(configSource); |
177 | } | 181 | } |
178 | else | 182 | else |
179 | { | 183 | { |
180 | Application.iniFilePath = Path.Combine(Util.configDir(), Application.iniFilePath); | 184 | Application.iniFilePath = Path.Combine(Util.configDir(), Application.iniFilePath); |
181 | if (File.Exists(Application.iniFilePath)) | 185 | if (File.Exists(Application.iniFilePath)) |
182 | { | 186 | { |
183 | m_config.Merge(new IniConfigSource(Application.iniFilePath)); | 187 | m_config.ConfigSource.Merge(new IniConfigSource(Application.iniFilePath)); |
184 | m_config.Merge(configSource); | 188 | m_config.ConfigSource.Merge(configSource); |
185 | } | 189 | } |
186 | else | 190 | else |
187 | { | 191 | { |
188 | // no default config files, so set default values, and save it | 192 | if (File.Exists("OpenSim.xml")) |
189 | m_config.Merge(DefaultConfig()); | 193 | { |
190 | m_config.Merge(configSource); | 194 | //chech for a xml config file |
191 | m_config.Save(Application.iniFilePath); | 195 | Application.iniFilePath = "OpenSim.xml"; |
196 | m_config.ConfigSource = new XmlConfigSource(); | ||
197 | m_config.ConfigSource.Merge(new XmlConfigSource(Application.iniFilePath)); | ||
198 | m_config.ConfigSource.Merge(configSource); | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | //Application.iniFilePath = "OpenSim.xml"; | ||
203 | // m_config.ConfigSource = new XmlConfigSource(); | ||
204 | // no default config files, so set default values, and save it | ||
205 | m_config.ConfigSource.Merge(DefaultConfig()); | ||
206 | m_config.ConfigSource.Merge(configSource); | ||
207 | m_config.Save(Application.iniFilePath); | ||
208 | } | ||
192 | } | 209 | } |
193 | } | 210 | } |
194 | 211 | ||
@@ -277,7 +294,7 @@ namespace OpenSim | |||
277 | { | 294 | { |
278 | m_networkServersInfo = new NetworkServersInfo(); | 295 | m_networkServersInfo = new NetworkServersInfo(); |
279 | 296 | ||
280 | IConfig startupConfig = m_config.Configs["Startup"]; | 297 | IConfig startupConfig = m_config.ConfigSource.Configs["Startup"]; |
281 | 298 | ||
282 | if (startupConfig != null) | 299 | if (startupConfig != null) |
283 | { | 300 | { |
@@ -306,7 +323,7 @@ namespace OpenSim | |||
306 | m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); | 323 | m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); |
307 | } | 324 | } |
308 | 325 | ||
309 | IConfig standaloneConfig = m_config.Configs["StandAlone"]; | 326 | IConfig standaloneConfig = m_config.ConfigSource.Configs["StandAlone"]; |
310 | if (standaloneConfig != null) | 327 | if (standaloneConfig != null) |
311 | { | 328 | { |
312 | m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", false); | 329 | m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", false); |
@@ -327,7 +344,7 @@ namespace OpenSim | |||
327 | m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); | 344 | m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); |
328 | } | 345 | } |
329 | 346 | ||
330 | m_networkServersInfo.loadFromConfiguration(m_config); | 347 | m_networkServersInfo.loadFromConfiguration(m_config.ConfigSource); |
331 | } | 348 | } |
332 | 349 | ||
333 | /// <summary> | 350 | /// <summary> |
@@ -380,11 +397,11 @@ namespace OpenSim | |||
380 | m_httpServer.AddStreamHandler(new SimStatusHandler()); | 397 | m_httpServer.AddStreamHandler(new SimStatusHandler()); |
381 | } | 398 | } |
382 | 399 | ||
383 | proxyUrl = ConfigSource.Configs["Network"].GetString("proxy_url", ""); | 400 | proxyUrl = ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_url", ""); |
384 | proxyOffset = Int32.Parse(ConfigSource.Configs["Network"].GetString("proxy_offset", "0")); | 401 | proxyOffset = Int32.Parse(ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_offset", "0")); |
385 | 402 | ||
386 | // Create a ModuleLoader instance | 403 | // Create a ModuleLoader instance |
387 | m_moduleLoader = new ModuleLoader(m_config); | 404 | m_moduleLoader = new ModuleLoader(m_config.ConfigSource); |
388 | 405 | ||
389 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); | 406 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); |
390 | foreach (TypeExtensionNode node in nodes) | 407 | foreach (TypeExtensionNode node in nodes) |
@@ -569,7 +586,7 @@ namespace OpenSim | |||
569 | return | 586 | return |
570 | new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, | 587 | new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, |
571 | storageManager, m_httpServer, | 588 | storageManager, m_httpServer, |
572 | m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config, | 589 | m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config.ConfigSource, |
573 | m_version); | 590 | m_version); |
574 | 591 | ||
575 | } | 592 | } |
@@ -618,7 +635,7 @@ namespace OpenSim | |||
618 | 635 | ||
619 | protected override PhysicsScene GetPhysicsScene() | 636 | protected override PhysicsScene GetPhysicsScene() |
620 | { | 637 | { |
621 | return GetPhysicsScene(m_physicsEngine, m_meshEngineName, m_config); | 638 | return GetPhysicsScene(m_physicsEngine, m_meshEngineName, m_config.ConfigSource); |
622 | } | 639 | } |
623 | 640 | ||
624 | /// <summary> | 641 | /// <summary> |
@@ -702,5 +719,24 @@ namespace OpenSim | |||
702 | regionnum = m_sceneManager.Scenes.Count; | 719 | regionnum = m_sceneManager.Scenes.Count; |
703 | } | 720 | } |
704 | } | 721 | } |
722 | |||
723 | public class OpenSimConfigSource | ||
724 | { | ||
725 | public IConfigSource ConfigSource; | ||
726 | |||
727 | public void Save(string path) | ||
728 | { | ||
729 | if (ConfigSource is IniConfigSource) | ||
730 | { | ||
731 | IniConfigSource iniCon = (IniConfigSource)ConfigSource; | ||
732 | iniCon.Save(path); | ||
733 | } | ||
734 | else if (ConfigSource is XmlConfigSource) | ||
735 | { | ||
736 | XmlConfigSource xmlCon = (XmlConfigSource)ConfigSource; | ||
737 | xmlCon.Save(path); | ||
738 | } | ||
739 | } | ||
740 | } | ||
705 | } | 741 | } |
706 | 742 | ||