aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2009-01-02 05:52:01 +0000
committerMelanie Thielker2009-01-02 05:52:01 +0000
commit18ba10b51c1a37fadd6c750c06f5672cfb15438a (patch)
tree1cbc8406c7436285f9c2efdd11add7941b3cede4 /OpenSim
parentMajor changes in interregion communications. This breaks compatibility with o... (diff)
downloadopensim-SC-18ba10b51c1a37fadd6c750c06f5672cfb15438a.zip
opensim-SC-18ba10b51c1a37fadd6c750c06f5672cfb15438a.tar.gz
opensim-SC-18ba10b51c1a37fadd6c750c06f5672cfb15438a.tar.bz2
opensim-SC-18ba10b51c1a37fadd6c750c06f5672cfb15438a.tar.xz
Add the ability to read the ini file from a URI. If the -inifile option
is a http:// URI, it will be fetched and parsed as an XML config.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs39
1 files changed, 33 insertions, 6 deletions
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index 12cb0ea..d55ad32 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using System.Xml;
31using System.Threading; 32using System.Threading;
32using System.IO; 33using System.IO;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -79,15 +80,41 @@ namespace OpenSim
79 } 80 }
80 else 81 else
81 { 82 {
82 // check for a xml config file 83 Uri configUri;
83 Application.iniFilePath = Path.Combine(Util.configDir(), "OpenSim.xml");
84 84
85 if (File.Exists(Application.iniFilePath)) 85 if (Uri.TryCreate(startupConfig.GetString("inifile", "OpenSim.ini"), UriKind.Absolute, out configUri) && configUri.Scheme == Uri.UriSchemeHttp)
86 { 86 {
87 iniFileExists = true; 87 Console.WriteLine("[CONFIG] {0} is a URI, fetching ...", startupConfig.GetString("inifile", "OpenSim.ini"));
88
89 // The ini file path is a http URI
90 // Try to read it
91 //
92 try
93 {
94 XmlReader r = XmlReader.Create(startupConfig.GetString("inifile", "OpenSim.ini"));
95 XmlConfigSource cs = new XmlConfigSource(r);
96 m_config.Source.Merge(cs);
97
98 iniFileExists = true;
99 Console.WriteLine("[CONFIG] Uri fetch complete");
100 }
101 catch (Exception e)
102 {
103 Console.WriteLine("Exception {0} reading config from URI {1}", e.ToString(), startupConfig.GetString("inifile", "OpenSim.ini"));
104 }
105 }
106 else
107 {
108 // check for a xml config file
109 Application.iniFilePath = Path.Combine(Util.configDir(), "OpenSim.xml");
110
111 if (File.Exists(Application.iniFilePath))
112 {
113 iniFileExists = true;
88 114
89 m_config.Source = new XmlConfigSource(); 115 m_config.Source = new XmlConfigSource();
90 m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); 116 m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));
117 }
91 } 118 }
92 } 119 }
93 120