diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Application/ConfigurationLoader.cs | 39 |
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 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using System.Xml; | ||
31 | using System.Threading; | 32 | using System.Threading; |
32 | using System.IO; | 33 | using System.IO; |
33 | using OpenSim.Framework; | 34 | using 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 | ||