Trying to guestimate sensible default values for GridInfoService if no

[GridInfo] section is supplied by OpenSim.ini; also adding log warning
if that is the case.
0.6.0-stable
Dr Scofield 2008-07-28 14:28:26 +00:00
parent f69ae29e39
commit 0512895eea
1 changed files with 37 additions and 7 deletions

View File

@ -65,15 +65,35 @@ namespace OpenSim.Common.Communications
IConfigSource _configSource = new IniConfigSource(configPath);
IConfig startupCfg = _configSource.Configs["Startup"];
IConfig gridCfg = _configSource.Configs["GridInfo"];
if (!startupCfg.GetBoolean("gridmode", false))
_info["mode"] = "standalone";
else
IConfig netCfg = _configSource.Configs["Network"];
bool grid = startupCfg.GetBoolean("gridmode", false);
if (grid)
_info["mode"] = "grid";
foreach (string k in gridCfg.GetKeys())
else
_info["mode"] = "standalone";
if (null != gridCfg)
{
_info[k] = gridCfg.GetString(k);
foreach (string k in gridCfg.GetKeys())
{
_info[k] = gridCfg.GetString(k);
}
}
else if (null != netCfg)
{
if (grid)
_info["login"] = netCfg.GetString("user_server_url");
else
_info["login"] = String.Format("http://127.0.0.1:{0}/", netCfg.GetString("http_listener_port"));
IssueWarning();
}
else
{
_info["login"] = "http://127.0.0.1:9000/";
IssueWarning();
}
}
catch (Exception)
@ -91,6 +111,16 @@ namespace OpenSim.Common.Communications
{
}
private void IssueWarning()
{
_log.Warn("[GridInfoService] found no [GridInfo] section in your OpenSim.ini");
_log.Warn("[GridInfoService] trying to guess sensible defaults, you might want to provide better ones:");
foreach (string k in _info.Keys)
{
_log.WarnFormat("[GridInfoService] {0}: {1}", k, _info[k]);
}
}
public XmlRpcResponse XmlRpcGridInfoMethod(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();