diff options
author | BlueWall | 2012-10-03 16:07:11 -0400 |
---|---|---|
committer | BlueWall | 2012-10-03 16:07:11 -0400 |
commit | 3e71c71cbffb0de454759e2bbd0ff840dfa480bc (patch) | |
tree | d6cbdc998bd4d7f9309bb73866e1ebaf72cb1b1b /OpenSim/Server/Base/ServerUtils.cs | |
parent | Allow setting connection limits, part 2 (diff) | |
download | opensim-SC_OLD-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.zip opensim-SC_OLD-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.gz opensim-SC_OLD-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.bz2 opensim-SC_OLD-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.xz |
Add modular configuration for Robust connectors
We can provide modular ini for connectors...
look for our configuration in the following places...
1) in the default ini/-inifile
2) in the named file (ConfigName) located in the configured directory
(see Robust[.HG].ini [Start] section for ConfigDirectory)
3) in the repository named in the connector (ConfigURL)
In this case, the file will be written into the configured
directory with the specified
See example connector/service @ https://github.com/BlueWall/SlipStream
for testing.
Diffstat (limited to 'OpenSim/Server/Base/ServerUtils.cs')
-rw-r--r-- | OpenSim/Server/Base/ServerUtils.cs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 42c82cf..4a696c4 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -33,6 +33,7 @@ using System.Xml.Serialization; | |||
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
35 | using log4net; | 35 | using log4net; |
36 | using Nini.Config; | ||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | 39 | ||
@@ -333,5 +334,42 @@ namespace OpenSim.Server.Base | |||
333 | 334 | ||
334 | return ret; | 335 | return ret; |
335 | } | 336 | } |
337 | |||
338 | public static IConfig GetConfig(string configFile, string configName) | ||
339 | { | ||
340 | IConfig config; | ||
341 | |||
342 | if (File.Exists(configFile)) | ||
343 | { | ||
344 | IConfigSource configsource = new IniConfigSource(configFile); | ||
345 | config = configsource.Configs[configName]; | ||
346 | } | ||
347 | else | ||
348 | config = null; | ||
349 | |||
350 | return config; | ||
351 | } | ||
352 | |||
353 | public static IConfigSource LoadInitialConfig(string url) | ||
354 | { | ||
355 | IConfigSource source = new XmlConfigSource(); | ||
356 | m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", url); | ||
357 | |||
358 | // The ini file path is a http URI | ||
359 | // Try to read it | ||
360 | try | ||
361 | { | ||
362 | XmlReader r = XmlReader.Create(url); | ||
363 | IConfigSource cs = new XmlConfigSource(r); | ||
364 | source.Merge(cs); | ||
365 | } | ||
366 | catch (Exception e) | ||
367 | { | ||
368 | m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), url); | ||
369 | Environment.Exit(1); | ||
370 | } | ||
371 | |||
372 | return source; | ||
373 | } | ||
336 | } | 374 | } |
337 | } | 375 | } |