diff options
author | Justin Clarke Casey | 2008-10-04 20:27:55 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-10-04 20:27:55 +0000 |
commit | 31362a67dfb5b1fe22100be17204e80252f261d9 (patch) | |
tree | 48c6ea822162202525aef8a11b42d2ece5378cef /OpenSim/Region/Application/OpenSimBase.cs | |
parent | * minor: both OpenSimBase and the Voice and RemoteAdmin modules were checking... (diff) | |
download | opensim-SC_OLD-31362a67dfb5b1fe22100be17204e80252f261d9.zip opensim-SC_OLD-31362a67dfb5b1fe22100be17204e80252f261d9.tar.gz opensim-SC_OLD-31362a67dfb5b1fe22100be17204e80252f261d9.tar.bz2 opensim-SC_OLD-31362a67dfb5b1fe22100be17204e80252f261d9.tar.xz |
* Tidy up configuration stuff, eliminated default setting duplication along the way
* This revision also makes the exception catcher of last resort print to the log instead of just the console
* This means logs should now capture sim crashing exceptions, though not those which are caused by a crash of the virtual machine itself
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 97 |
1 files changed, 41 insertions, 56 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index c1a5825..710dafb 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -150,48 +150,39 @@ namespace OpenSim | |||
150 | set { m_moduleLoader = value; } | 150 | set { m_moduleLoader = value; } |
151 | } | 151 | } |
152 | 152 | ||
153 | /// <summary> | ||
154 | /// Constructor. | ||
155 | /// </summary> | ||
156 | /// <param name="configSource"></param> | ||
153 | public OpenSimBase(IConfigSource configSource) : base() | 157 | public OpenSimBase(IConfigSource configSource) : base() |
154 | { | 158 | { |
155 | IConfig startupConfig = configSource.Configs["Startup"]; | 159 | IConfig startupConfig = configSource.Configs["Startup"]; |
156 | 160 | ||
157 | Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini"); | 161 | string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini"); |
162 | Application.iniFilePath = Path.Combine(Util.configDir(), iniFileName); | ||
158 | 163 | ||
159 | m_config = new OpenSimConfigSource(); | 164 | m_config = new OpenSimConfigSource(); |
160 | m_config.Source = new IniConfigSource(); | 165 | m_config.Source = new IniConfigSource(); |
161 | // IConfigSource icong; | 166 | m_config.Source.Merge(DefaultConfig()); |
162 | 167 | ||
163 | //check for .INI file (either default or name passed in command line) | 168 | //check for .INI file (either default or name passed in command line) |
164 | if (File.Exists(Application.iniFilePath)) | 169 | if (File.Exists(Application.iniFilePath)) |
165 | { | 170 | { |
171 | // From reading Nini's code, it seems that later merged keys replace earlier ones. | ||
166 | m_config.Source.Merge(new IniConfigSource(Application.iniFilePath)); | 172 | m_config.Source.Merge(new IniConfigSource(Application.iniFilePath)); |
167 | m_config.Source.Merge(configSource); | 173 | m_config.Source.Merge(configSource); |
168 | } | 174 | } |
169 | else | 175 | else |
170 | { | 176 | { |
171 | Application.iniFilePath = Path.Combine(Util.configDir(), Application.iniFilePath); | 177 | // check for a xml config file |
178 | Application.iniFilePath = Path.Combine(Util.configDir(), "OpenSim.xml"); | ||
179 | |||
172 | if (File.Exists(Application.iniFilePath)) | 180 | if (File.Exists(Application.iniFilePath)) |
173 | { | 181 | { |
174 | m_config.Source.Merge(new IniConfigSource(Application.iniFilePath)); | 182 | m_config.Source = new XmlConfigSource(); |
183 | m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); | ||
175 | m_config.Source.Merge(configSource); | 184 | m_config.Source.Merge(configSource); |
176 | } | 185 | } |
177 | else | ||
178 | { | ||
179 | if (File.Exists("OpenSim.xml")) | ||
180 | { | ||
181 | // check for a xml config file | ||
182 | Application.iniFilePath = "OpenSim.xml"; | ||
183 | m_config.Source = new XmlConfigSource(); | ||
184 | m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); | ||
185 | m_config.Source.Merge(configSource); | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | // using OpenSim.ini instead | ||
190 | m_config.Source.Merge(DefaultConfig()); | ||
191 | m_config.Source.Merge(configSource); | ||
192 | m_config.Save(Application.iniFilePath); | ||
193 | } | ||
194 | } | ||
195 | } | 186 | } |
196 | 187 | ||
197 | ReadConfigSettings(); | 188 | ReadConfigSettings(); |
@@ -213,17 +204,17 @@ namespace OpenSim | |||
213 | 204 | ||
214 | config.Set("gridmode", false); | 205 | config.Set("gridmode", false); |
215 | config.Set("physics", "basicphysics"); | 206 | config.Set("physics", "basicphysics"); |
207 | config.Set("meshing", "ZeroMesher"); | ||
216 | config.Set("physical_prim", true); | 208 | config.Set("physical_prim", true); |
217 | config.Set("see_into_this_sim_from_neighbor", true); | 209 | config.Set("see_into_this_sim_from_neighbor", true); |
218 | config.Set("serverside_object_permissions", false); | 210 | config.Set("serverside_object_permissions", false); |
219 | config.Set("storage_plugin", "OpenSim.Data.SQLite.dll"); | 211 | config.Set("storage_plugin", "OpenSim.Data.SQLite.dll"); |
220 | config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3"); | 212 | config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3"); |
221 | config.Set("storage_prim_inventories", true); | 213 | config.Set("storage_prim_inventories", true); |
222 | config.Set("startup_console_commands_file", String.Empty); | 214 | config.Set("startup_console_commands_file", String.Empty); |
223 | config.Set("shutdown_console_commands_file", String.Empty); | 215 | config.Set("shutdown_console_commands_file", String.Empty); |
224 | config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | 216 | config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); |
225 | config.Set("DefaultScriptEngine", "DotNetEngine"); | 217 | config.Set("DefaultScriptEngine", "DotNetEngine"); |
226 | |||
227 | config.Set("asset_database", "sqlite"); | 218 | config.Set("asset_database", "sqlite"); |
228 | config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); | 219 | config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); |
229 | } | 220 | } |
@@ -277,48 +268,42 @@ namespace OpenSim | |||
277 | 268 | ||
278 | if (startupConfig != null) | 269 | if (startupConfig != null) |
279 | { | 270 | { |
280 | m_sandbox = !startupConfig.GetBoolean("gridmode", false); | 271 | m_sandbox = !startupConfig.GetBoolean("gridmode"); |
281 | m_physicsEngine = startupConfig.GetString("physics", "basicphysics"); | 272 | m_physicsEngine = startupConfig.GetString("physics"); |
282 | m_meshEngineName = startupConfig.GetString("meshing", "ZeroMesher"); | 273 | m_meshEngineName = startupConfig.GetString("meshing"); |
283 | 274 | ||
284 | m_physicalPrim = startupConfig.GetBoolean("physical_prim", true); | 275 | m_physicalPrim = startupConfig.GetBoolean("physical_prim"); |
285 | 276 | ||
286 | m_see_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor", true); | 277 | m_see_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor"); |
287 | 278 | ||
288 | m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.Data.SQLite.dll"); | 279 | m_storageDll = startupConfig.GetString("storage_plugin"); |
289 | if (m_storageDll == "OpenSim.DataStore.MonoSqlite.dll") | 280 | if (m_storageDll == "OpenSim.DataStore.MonoSqlite.dll") |
290 | { | 281 | { |
291 | m_storageDll = "OpenSim.Data.SQLite.dll"; | 282 | m_storageDll = "OpenSim.Data.SQLite.dll"; |
292 | Console.WriteLine("WARNING: OpenSim.DataStore.MonoSqlite.dll is deprecated. Set storage_plugin to OpenSim.Data.SQLite.dll."); | 283 | Console.WriteLine("WARNING: OpenSim.DataStore.MonoSqlite.dll is deprecated. Set storage_plugin to OpenSim.Data.SQLite.dll."); |
293 | Thread.Sleep(3000); | 284 | Thread.Sleep(3000); |
294 | } | 285 | } |
295 | m_storageConnectionString | 286 | |
296 | = startupConfig.GetString("storage_connection_string", "URI=file:OpenSim.db,version=3"); | 287 | m_storageConnectionString = startupConfig.GetString("storage_connection_string"); |
297 | m_estateConnectionString | 288 | m_estateConnectionString = startupConfig.GetString("estate_connection_string", m_storageConnectionString); |
298 | = startupConfig.GetString("estate_connection_string", m_storageConnectionString); | 289 | m_assetStorage = startupConfig.GetString("asset_database"); |
299 | m_assetStorage = startupConfig.GetString("asset_database", "local"); | 290 | m_clientstackDll = startupConfig.GetString("clientstack_plugin"); |
300 | m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); | ||
301 | } | 291 | } |
302 | 292 | ||
303 | IConfig standaloneConfig = m_config.Source.Configs["StandAlone"]; | 293 | IConfig standaloneConfig = m_config.Source.Configs["StandAlone"]; |
304 | if (standaloneConfig != null) | 294 | if (standaloneConfig != null) |
305 | { | 295 | { |
306 | m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", false); | 296 | m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate"); |
307 | m_standaloneWelcomeMessage = standaloneConfig.GetString("welcome_message", "Welcome to OpenSim"); | 297 | m_standaloneWelcomeMessage = standaloneConfig.GetString("welcome_message"); |
308 | m_standaloneInventoryPlugin = | 298 | |
309 | standaloneConfig.GetString("inventory_plugin", "OpenSim.Data.SQLite.dll"); | 299 | m_standaloneInventoryPlugin = standaloneConfig.GetString("inventory_plugin"); |
310 | m_standaloneInventorySource = | 300 | m_standaloneInventorySource = standaloneConfig.GetString("inventory_source"); |
311 | standaloneConfig.GetString("inventory_source",""); | 301 | m_standaloneUserPlugin = standaloneConfig.GetString("userDatabase_plugin"); |
312 | m_standaloneUserPlugin = | 302 | m_standaloneUserSource = standaloneConfig.GetString("user_source"); |
313 | standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Data.SQLite.dll"); | 303 | m_standaloneAssetPlugin = standaloneConfig.GetString("asset_plugin"); |
314 | m_standaloneUserSource = | 304 | m_standaloneAssetSource = standaloneConfig.GetString("asset_source"); |
315 | standaloneConfig.GetString("user_source",""); | 305 | |
316 | m_standaloneAssetPlugin = | 306 | m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file"); |
317 | standaloneConfig.GetString("asset_plugin", "OpenSim.Data.SQLite.dll"); | ||
318 | m_standaloneAssetSource = | ||
319 | standaloneConfig.GetString("asset_source",""); | ||
320 | |||
321 | m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); | ||
322 | } | 307 | } |
323 | 308 | ||
324 | m_networkServersInfo.loadFromConfiguration(m_config.Source); | 309 | m_networkServersInfo.loadFromConfiguration(m_config.Source); |