From 0512895eeaf2d84a025c04927ffa5bf3c4003464 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Mon, 28 Jul 2008 14:28:26 +0000 Subject: 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. --- OpenSim/Common/Communications/GridInfoService.cs | 44 ++++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/OpenSim/Common/Communications/GridInfoService.cs b/OpenSim/Common/Communications/GridInfoService.cs index f8208ad..adaaa95 100644 --- a/OpenSim/Common/Communications/GridInfoService.cs +++ b/OpenSim/Common/Communications/GridInfoService.cs @@ -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) + { + 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[k] = gridCfg.GetString(k); + _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(); -- cgit v1.1