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.

user_profiles
Diva Canto 2013-02-21 17:26:19 -08:00
parent efb5da0aa6
commit e515cdddec
16 changed files with 152 additions and 66 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 + "/";

View File

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

View File

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

View File

@ -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 + "/";

View File

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

View File

@ -346,6 +346,21 @@
;; - "Imprudence 1.3.1" has access
; BannedViewerList =
;# {HomeURI} {Hypergrid} {The Home URL of this world} {}
;; If this is a standalone world, this is the address of this instance.
;; If this is a grided simulator, this is the address of the external robust server that
;; runs the UserAgentsService.
;; For example http://myworld.com:9000 or http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; HomeURI = "http://127.0.0.1:9000"
;# {GatekeeperURI} {Hypergrid} {The URL of the gatekeeper of this world} {}
;; If this is a standalone world, this is the address of this instance.
;; If this is a grided simulator, this is the address of the external robust server
;; that runs the Gatekeeper service.
;; For example http://myworld.com:9000 or http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; GatekeeperURI = "http://127.0.0.1:9000"
[Estates]
; If these values are commented out then the user will be asked for estate details when required (this is the normal case).
@ -961,6 +976,7 @@
;# {HomeURI} {ServicesConnectorModule:Groups HG Service Connector} {What's the home address of this world?} {}
;; Used for V2 in HG only. For example
;; http://mygridserver.com:9000 or http://mygridserver.com:8002
;; If you have this set under [Startup], no need to set it here, leave it commented
; HomeURI = ""
;# {MessagingEnabled} {Module:GroupsModule Module:Groups Module V2} {Is groups messaging enabled?} {true false} true

View File

@ -22,17 +22,31 @@
; *
[Startup]
; Plugin Registry Location
; Set path to directory for plugin registry. Information
; about the registered repositories and installed plugins
; will be stored here
; The Robust.exe process must hvae R/W access to the location
RegistryLocation = "."
; Plugin Registry Location
; Set path to directory for plugin registry. Information
; about the registered repositories and installed plugins
; will be stored here
; The Robust.exe process must hvae R/W access to the location
RegistryLocation = "."
; Modular configurations
; Set path to directory for modular ini files...
; The Robust.exe process must hvae R/W access to the location
ConfigDirectory = "/home/opensim/etc/Configs"
; Modular configurations
; Set path to directory for modular ini files...
; The Robust.exe process must hvae R/W access to the location
ConfigDirectory = "/home/opensim/etc/Configs"
;# {HomeURI} {Hypergrid} {The Home URL of this world} {}
;; This is the address of the external robust server that
;; runs the UserAgentsService, possibly this server.
;; For example http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; HomeURI = "http://127.0.0.1:8002"
;# {GatekeeperURI} {Hypergrid} {The URL of the gatekeeper of this world} {}
;; This is the address of the external robust server
;; that runs the Gatekeeper service, possibly this server.
;; For example http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; GatekeeperURI = "http://127.0.0.1:8002"
[ServiceList]
@ -155,7 +169,8 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
;; Allow Hyperlinks to be created at the console
HypergridLinker = true
Gatekeeper = "http://127.0.0.1:8002"
;; If you have this set under [Startup], no need to set it here, leave it commented
; GatekeeperURI = "http://127.0.0.1:8002"
; * This is the configuration for the freeswitch server in grid mode
@ -309,8 +324,8 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
; HasProxy = false
; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs)
; CHANGE THIS
GatekeeperURI = "http://127.0.0.1:8002"
;; If you have Gatekeeper set under [Startup], no need to set it here, leave it commented
; GatekeeperURI = "http://127.0.0.1:8002"
SRV_HomeURI = "http://127.0.0.1:8002"
SRV_InventoryServerURI = "http://127.0.0.1:8002"
@ -417,8 +432,8 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
AuthenticationService = "OpenSim.Services.Connectors.dll:AuthenticationServicesConnector"
SimulationService ="OpenSim.Services.Connectors.dll:SimulationServiceConnector"
; how does the outside world reach me? This acts as public key too.
; CHANGE THIS
ExternalName = "http://127.0.0.1:8002"
;; If you have GatekeeperURI set under [Startup], no need to set it here, leave it commented
; ExternalName = "http://127.0.0.1:8002"
; Does this grid allow incoming links to any region in it?
; If false, HG TPs happen only to the Default regions specified in [GridService] section
@ -511,7 +526,9 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
HomeURI = "http://127.0.0.1:8002"
;; Can overwrite the default in [Startup], but probably shouldn't
; HomeURI = "http://127.0.0.1:8002"
; * The interface that local users get when they are in other grids.
; * This restricts the access that the rest of the world has to
@ -520,7 +537,9 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
[HGAssetService]
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGAssetService"
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
HomeURI = "http://127.0.0.1:8002"
;; Can overwrite the default in [Startup], but probably shouldn't
; HomeURI = "http://127.0.0.1:8002"
;; The asset types that this grid can export to / import from other grids.
;; Comma separated.
@ -557,6 +576,10 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
[Groups]
;; for the HG Groups service
OfflineIMService = "OpenSim.Addons.OfflineIM.dll:OfflineIMService"
; What is the HomeURI of users associated with this grid?
HomeURI = "http://127.0.0.1:8002"
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
;; What is the HomeURI of users associated with this grid?
;; Can overwrite the default in [Startup], but probably shouldn't
; HomeURI = "http://127.0.0.1:8002"

View File

@ -64,8 +64,8 @@
Region_Welcome_Area = "DefaultRegion, FallbackRegion"
; === HG ONLY ===
;; change this to the address of your simulator
Gatekeeper="http://127.0.0.1:9000"
;; If you have this set under [Startup], no need to set it here, leave it commented
; GatekeeperURI="http://127.0.0.1:9000"
[LibraryModule]
; Set this if you want to change the name of the OpenSim Library
@ -73,7 +73,8 @@
[LoginService]
WelcomeMessage = "Welcome, Avatar!"
GatekeeperURI = "http://127.0.0.1:9000"
;; If you have Gatekeeper set under [Startup], no need to set it here, leave it commented
; GatekeeperURI = "http://127.0.0.1:9000"
SRV_HomeURI = "http://127.0.0.1:9000"
SRV_InventoryServerURI = "http://127.0.0.1:9000"
@ -218,7 +219,8 @@
;; HG configurations
;;
[GatekeeperService]
ExternalName = "http://127.0.0.1:9000"
;; If you have GatekeeperURI set under [Startup], no need to set it here, leave it commented
; ExternalName = "http://127.0.0.1:9000"
; Does this grid allow incoming links to any region in it?
; If false, HG TPs happen only to the Default regions specified in [GridService] section
@ -274,10 +276,12 @@
; AllowExcept_Level_200 = "http://griefer.com:8002, http://enemy.com:8002"
[HGInventoryService]
HomeURI = "http://127.0.0.1:9000"
;; If you have this set under [Startup], no need to set it here, leave it commented
; HomeURI = "http://127.0.0.1:9000"
[HGAssetService]
HomeURI = "http://127.0.0.1:9000"
;; If you have this set under [Startup], no need to set it here, leave it commented
; HomeURI = "http://127.0.0.1:9000"
;; The asset types that this grid can export to / import from other grids.
;; Comma separated.
@ -293,8 +297,9 @@
[HGInventoryAccessModule]
HomeURI = "http://127.0.0.1:9000"
Gatekeeper = "http://127.0.0.1:9000"
;; If you have these set under [Startup], no need to set it here, leave it commented
; HomeURI = "http://127.0.0.1:9000"
; GatekeeperURI = "http://127.0.0.1:9000"
;; If you want to protect your assets from being copied by foreign visitors
;; uncomment the next line. You may want to do this on sims that have licensed content.
@ -311,8 +316,8 @@
[Messaging]
; === HG ONLY ===
;; change this to the address of your simulator
Gatekeeper = "http://127.0.0.1:9000"
;; If you have this set under [Startup], no need to set it here, leave it commented
; GatekeeperURI = "http://127.0.0.1:9000"
[EntityTransfer]