mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
Simplification of HG configs: HomeURI and GatekeeperURI now are defined as default under [Startup]. They can then be overwritten in the other sections (but probably shouldn't). I kept the existing code for backwards compatibility, so this should not cause any breaks from people's current configurations. But people should move to have these 2 vars under [Startup] -- see OpenSim.ini.example and Robust.HG.ini.example. And yes, both names now end with "URI" for consistency.
This commit is contained in:
@@ -863,7 +863,7 @@ namespace OpenSim.Framework
|
||||
return FileName;
|
||||
}
|
||||
|
||||
// Nini (config) related Methods
|
||||
#region Nini (config) related Methods
|
||||
public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName)
|
||||
{
|
||||
if (!File.Exists(fileName))
|
||||
@@ -886,6 +886,26 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetConfigVarWithDefaultSection(IConfigSource config, string varname, string section)
|
||||
{
|
||||
// First, check the Startup section, the default section
|
||||
IConfig cnf = config.Configs["Startup"];
|
||||
if (cnf == null)
|
||||
return string.Empty;
|
||||
string val = cnf.GetString(varname, string.Empty);
|
||||
|
||||
// Then check for an overwrite of the default in the given section
|
||||
if (!string.IsNullOrEmpty(section))
|
||||
{
|
||||
cnf = config.Configs[section];
|
||||
if (cnf != null)
|
||||
val = cnf.GetString(varname, val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static float Clip(float x, float min, float max)
|
||||
{
|
||||
return Math.Min(Math.Max(x, min), max);
|
||||
|
||||
Reference in New Issue
Block a user