Add a "inimaster" switch to OpenSim.ini. It will load a master ini file

and then the OpenSim.ini only needs to contain instance specific data
0.6.0-stable
Melanie Thielker 2008-10-11 17:51:16 +00:00
parent 4c337c48c7
commit 143419ebb2
2 changed files with 15 additions and 3 deletions

View File

@ -72,6 +72,7 @@ namespace OpenSim
configSource.AddSwitch("Startup", "background"); configSource.AddSwitch("Startup", "background");
configSource.AddSwitch("Startup", "inifile"); configSource.AddSwitch("Startup", "inifile");
configSource.AddSwitch("Startup", "inimaster");
configSource.AddSwitch("Startup", "gridmode"); configSource.AddSwitch("Startup", "gridmode");
configSource.AddSwitch("Startup", "physics"); configSource.AddSwitch("Startup", "physics");
configSource.AddSwitch("Startup", "useexecutepath"); configSource.AddSwitch("Startup", "useexecutepath");

View File

@ -161,20 +161,30 @@ namespace OpenSim
IConfig startupConfig = configSource.Configs["Startup"]; IConfig startupConfig = configSource.Configs["Startup"];
string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini"); string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");
if (!iniFileName.StartsWith("/") && !iniFileName.StartsWith("\\"))
Application.iniFilePath = Path.Combine(Util.configDir(), iniFileName); Application.iniFilePath = Path.Combine(Util.configDir(), iniFileName);
string masterFileName = startupConfig.GetString("inimaster", "");
string masterfilePath = masterFileName;
if (!masterFileName.StartsWith("/") && !masterFileName.StartsWith("\\") && masterFileName != "")
masterfilePath = Path.Combine(Util.configDir(), masterfilePath);
m_config = new OpenSimConfigSource(); m_config = new OpenSimConfigSource();
m_config.Source = new IniConfigSource(); m_config.Source = new IniConfigSource();
m_config.Source.Merge(DefaultConfig()); m_config.Source.Merge(DefaultConfig());
//check for .INI file (either default or name passed in command line) //check for .INI file (either default or name passed in command line)
if (File.Exists(masterfilePath))
{
m_config.Source.Merge(new IniConfigSource(masterfilePath));
}
if (File.Exists(Application.iniFilePath)) if (File.Exists(Application.iniFilePath))
{ {
iniFileExists = true; iniFileExists = true;
// From reading Nini's code, it seems that later merged keys replace earlier ones. // From reading Nini's code, it seems that later merged keys replace earlier ones.
m_config.Source.Merge(new IniConfigSource(Application.iniFilePath)); m_config.Source.Merge(new IniConfigSource(Application.iniFilePath));
m_config.Source.Merge(configSource);
} }
else else
{ {
@ -187,9 +197,10 @@ namespace OpenSim
m_config.Source = new XmlConfigSource(); m_config.Source = new XmlConfigSource();
m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));
}
}
m_config.Source.Merge(configSource); m_config.Source.Merge(configSource);
}
}
if (!iniFileExists) if (!iniFileExists)
m_config.Save("OpenSim.ini"); m_config.Save("OpenSim.ini");