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:
@@ -65,14 +65,14 @@ namespace OpenSim.Groups
|
||||
|
||||
m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName);
|
||||
|
||||
string homeURI = Util.GetConfigVarWithDefaultSection(config, "HomeURI", m_ConfigName); //cnf.GetString("HomeURI", string.Empty);
|
||||
if (homeURI == string.Empty)
|
||||
throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName));
|
||||
|
||||
IConfig cnf = config.Configs[m_ConfigName];
|
||||
if (cnf == null)
|
||||
throw new Exception(String.Format("[Groups.RobustHGConnector]: {0} section does not exist", m_ConfigName));
|
||||
|
||||
string homeURI = cnf.GetString("HomeURI", string.Empty);
|
||||
if (homeURI == string.Empty)
|
||||
throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI in section {0}", m_ConfigName));
|
||||
|
||||
if (im == null)
|
||||
{
|
||||
string imDll = cnf.GetString("OfflineIMService", string.Empty);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -65,7 +65,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
{
|
||||
m_Enabled = true;
|
||||
|
||||
m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", string.Empty);
|
||||
m_ThisGridURL = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "Messaging");
|
||||
// Legacy. Remove soon!
|
||||
m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL);
|
||||
m_log.DebugFormat("[LURE MODULE]: {0} enabled", Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,12 +88,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
|
||||
if (thisModuleConfig != null)
|
||||
{
|
||||
// legacy configuration [obsolete]
|
||||
m_HomeURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty);
|
||||
// preferred
|
||||
m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI);
|
||||
m_HomeURI = Util.GetConfigVarWithDefaultSection(source, "HomeURI", "HGInventoryAccessModule");
|
||||
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
|
||||
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty);
|
||||
m_ThisGatekeeper = Util.GetConfigVarWithDefaultSection(source, "GatekeeperURI", "HGInventoryAccessModule");
|
||||
// Legacy. Renove soon!
|
||||
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", m_ThisGatekeeper);
|
||||
m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -113,9 +113,16 @@ namespace OpenSim.Region.DataSnapshot
|
||||
try
|
||||
{
|
||||
m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
|
||||
IConfig conf = config.Configs["GridService"];
|
||||
if (conf != null)
|
||||
m_gridinfo.Add("gatekeeperURL", conf.GetString("Gatekeeper", String.Empty));
|
||||
string gatekeeper = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "GridService");
|
||||
// Legacy. Remove soon!
|
||||
if (string.IsNullOrEmpty(gatekeeper))
|
||||
{
|
||||
IConfig conf = config.Configs["GridService"];
|
||||
if (conf != null)
|
||||
gatekeeper = conf.GetString("Gatekeeper", gatekeeper);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(gatekeeper))
|
||||
m_gridinfo.Add("gatekeeperURL", gatekeeper);
|
||||
|
||||
m_gridinfo.Add(
|
||||
"name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
|
||||
|
||||
@@ -2137,9 +2137,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
string HomeURI = String.Empty;
|
||||
IConfigSource config = m_ScriptEngine.ConfigSource;
|
||||
string HomeURI = Util.GetConfigVarWithDefaultSection(config, "HomeURI", string.Empty);
|
||||
|
||||
if (!string.IsNullOrEmpty(HomeURI))
|
||||
return HomeURI;
|
||||
|
||||
// Legacy. Remove soon!
|
||||
if (config.Configs["LoginService"] != null)
|
||||
HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI);
|
||||
|
||||
@@ -2154,9 +2158,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
string gatekeeperURI = String.Empty;
|
||||
IConfigSource config = m_ScriptEngine.ConfigSource;
|
||||
string gatekeeperURI = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", string.Empty);
|
||||
|
||||
if (!string.IsNullOrEmpty(gatekeeperURI))
|
||||
return gatekeeperURI;
|
||||
|
||||
// Legacy. Remove soon!
|
||||
if (config.Configs["GridService"] != null)
|
||||
gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI);
|
||||
|
||||
|
||||
@@ -170,14 +170,6 @@ namespace OpenSim.Server.Handlers.Grid
|
||||
public string JsonGetGridInfoMethod(string request, string path, string param,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
string HomeURI = String.Empty;
|
||||
IConfig cfg = m_Config.Configs["LoginService"];
|
||||
|
||||
if (null != cfg)
|
||||
{
|
||||
HomeURI = cfg.GetString("SRV_HomeURI", HomeURI);
|
||||
}
|
||||
|
||||
OSDMap map = new OSDMap();
|
||||
|
||||
foreach (string k in _info.Keys)
|
||||
@@ -185,9 +177,19 @@ namespace OpenSim.Server.Handlers.Grid
|
||||
map[k] = OSD.FromString(_info[k].ToString());
|
||||
}
|
||||
|
||||
string HomeURI = Util.GetConfigVarWithDefaultSection(m_Config, "HomeURI", string.Empty);
|
||||
|
||||
if (!String.IsNullOrEmpty(HomeURI))
|
||||
map["home"] = OSD.FromString(HomeURI);
|
||||
else // Legacy. Remove soon!
|
||||
{
|
||||
map["home"] = OSD.FromString(HomeURI);
|
||||
IConfig cfg = m_Config.Configs["LoginService"];
|
||||
|
||||
if (null != cfg)
|
||||
HomeURI = cfg.GetString("SRV_HomeURI", HomeURI);
|
||||
|
||||
if (!String.IsNullOrEmpty(HomeURI))
|
||||
map["home"] = OSD.FromString(HomeURI);
|
||||
}
|
||||
|
||||
return OSDParser.SerializeJsonString(map).ToString();
|
||||
|
||||
@@ -128,7 +128,9 @@ namespace OpenSim.Services.GridService
|
||||
|
||||
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
|
||||
|
||||
m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty);
|
||||
m_ThisGatekeeper = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "GridService");
|
||||
// Legacy. Remove soon!
|
||||
m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper);
|
||||
try
|
||||
{
|
||||
m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper);
|
||||
|
||||
@@ -96,7 +96,8 @@ namespace OpenSim.Services.HypergridService
|
||||
UUID.TryParse(scope, out m_ScopeID);
|
||||
//m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
|
||||
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
|
||||
m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
m_ExternalName = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "GatekeeperService");
|
||||
m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName);
|
||||
if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
|
||||
m_ExternalName = m_ExternalName + "/";
|
||||
|
||||
|
||||
@@ -81,10 +81,7 @@ namespace OpenSim.Services.HypergridService
|
||||
if (m_UserAccountService == null)
|
||||
throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
|
||||
|
||||
// legacy configuration [obsolete]
|
||||
m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty);
|
||||
// Preferred
|
||||
m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL);
|
||||
m_HomeURL = Util.GetConfigVarWithDefaultSection(config, "HomeURI", m_ConfigName);
|
||||
|
||||
m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
|
||||
}
|
||||
|
||||
@@ -96,8 +96,7 @@ namespace OpenSim.Services.HypergridService
|
||||
if (m_AvatarService == null)
|
||||
throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll));
|
||||
|
||||
// Preferred
|
||||
m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL);
|
||||
m_HomeURL = Util.GetConfigVarWithDefaultSection(config, "HomeURI", m_ConfigName);
|
||||
|
||||
// m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
|
||||
}
|
||||
|
||||
@@ -131,12 +131,17 @@ namespace OpenSim.Services.HypergridService
|
||||
LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions);
|
||||
LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions);
|
||||
|
||||
m_GridName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
if (m_GridName == string.Empty)
|
||||
m_GridName = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "UserAgentService");
|
||||
if (string.IsNullOrEmpty(m_GridName)) // Legacy. Remove soon.
|
||||
{
|
||||
serverConfig = config.Configs["GatekeeperService"];
|
||||
m_GridName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
if (m_GridName == string.Empty)
|
||||
{
|
||||
serverConfig = config.Configs["GatekeeperService"];
|
||||
m_GridName = serverConfig.GetString("ExternalName", string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_GridName.EndsWith("/"))
|
||||
m_GridName = m_GridName + "/";
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace OpenSim.Services.LLLoginService
|
||||
m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
|
||||
m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
|
||||
m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
|
||||
m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
|
||||
m_GatekeeperURL = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "LoginService");
|
||||
m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
|
||||
m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
|
||||
m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
|
||||
|
||||
Reference in New Issue
Block a user