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>" (path is local to bin\) when starting up opensim.exe.
GenericGridServerConcept
MW 2009-02-27 14:17:57 +00:00
parent cddaaf3e13
commit b83d5c7cdb
2 changed files with 15 additions and 1 deletions

View File

@ -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");

View File

@ -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);