From b83d5c7cdb3edba593b660ed8499e1a4bc9de43b Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 27 Feb 2009 14:17:57 +0000 Subject: [PATCH] Added support for reading ini files from a (optional) config folder. This allows the spliting up of opensim.ini into multiple ini files. The ini files in this folder are loaded after the masterini file (if that is set) and before opensim.ini. The default folder it looks for and searches is "bin\config", but that can be set by using the command arg "-inidirectory=" (path is local to bin\) when starting up opensim.exe. --- OpenSim/Region/Application/Application.cs | 1 + OpenSim/Region/Application/ConfigurationLoader.cs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 017160acfa..0c01b02545 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -78,6 +78,7 @@ namespace OpenSim configSource.AddSwitch("Startup", "background"); configSource.AddSwitch("Startup", "inifile"); configSource.AddSwitch("Startup", "inimaster"); + configSource.AddSwitch("Startup", "inidirectory"); configSource.AddSwitch("Startup", "gridmode"); configSource.AddSwitch("Startup", "physics"); configSource.AddSwitch("Startup", "useexecutepath"); diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index f3f9f29881..64797dabd6 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -62,6 +62,9 @@ namespace OpenSim string masterFileName = startupConfig.GetString("inimaster", ""); string masterfilePath = Path.Combine(Util.configDir(), masterFileName); + string iniDirName = startupConfig.GetString("inidirectory", "config"); + string iniDirPath = Path.Combine(Util.configDir(), iniDirName); + m_config = new OpenSimConfigSource(); m_config.Source = new IniConfigSource(); m_config.Source.Merge(DefaultConfig()); @@ -84,6 +87,17 @@ namespace OpenSim } } + if (Directory.Exists(iniDirName)) + { + m_log.InfoFormat("Searching folder: {0} , for config ini files", iniDirName); + string[] fileEntries = Directory.GetFiles(iniDirName); + foreach (string filePath in fileEntries) + { + // m_log.InfoFormat("reading ini file < {0} > from config dir", filePath); + ReadConfig(Path.GetFileName(filePath), filePath, m_config, false); + } + } + // Check for .INI file (either default or name passed on command // line) or XML config source over http bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) && configUri.Scheme == Uri.UriSchemeHttp; @@ -251,7 +265,6 @@ namespace OpenSim protected virtual void ReadConfigSettings() { IConfig startupConfig = m_config.Source.Configs["Startup"]; - if (startupConfig != null) { m_configSettings.Standalone = !startupConfig.GetBoolean("gridmode", false);