aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/GridInfoService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/GridInfoService.cs')
-rw-r--r--OpenSim/Framework/Communications/GridInfoService.cs66
1 files changed, 31 insertions, 35 deletions
diff --git a/OpenSim/Framework/Communications/GridInfoService.cs b/OpenSim/Framework/Communications/GridInfoService.cs
index d51bc59..ad60638 100644
--- a/OpenSim/Framework/Communications/GridInfoService.cs
+++ b/OpenSim/Framework/Communications/GridInfoService.cs
@@ -55,59 +55,55 @@ namespace OpenSim.Framework.Communications
55 /// anything else requires a general redesign of the config 55 /// anything else requires a general redesign of the config
56 /// system. 56 /// system.
57 /// </remarks> 57 /// </remarks>
58 public GridInfoService(string configPath) 58 public GridInfoService(IConfigSource configSource)
59 { 59 {
60 _info["platform"] = "OpenSim"; 60 _info["platform"] = "OpenSim";
61 if (File.Exists(configPath)) 61 try
62 { 62 {
63 try 63 IConfig startupCfg = configSource.Configs["Startup"];
64 IConfig gridCfg = configSource.Configs["GridInfo"];
65 IConfig netCfg = configSource.Configs["Network"];
66
67 bool grid = startupCfg.GetBoolean("gridmode", false);
68
69 if (grid)
70 _info["mode"] = "grid";
71 else
72 _info["mode"] = "standalone";
73
74
75 if (null != gridCfg)
64 { 76 {
65 IConfigSource _configSource = new IniConfigSource(configPath); 77 foreach (string k in gridCfg.GetKeys())
66 IConfig startupCfg = _configSource.Configs["Startup"];
67 IConfig gridCfg = _configSource.Configs["GridInfo"];
68 IConfig netCfg = _configSource.Configs["Network"];
69
70 bool grid = startupCfg.GetBoolean("gridmode", false);
71
72 if (grid)
73 _info["mode"] = "grid";
74 else
75 _info["mode"] = "standalone";
76
77
78 if (null != gridCfg)
79 { 78 {
80 foreach (string k in gridCfg.GetKeys()) 79 _info[k] = gridCfg.GetString(k);
81 {
82 _info[k] = gridCfg.GetString(k);
83 }
84 } 80 }
85 else if (null != netCfg) 81 }
86 { 82 else if (null != netCfg)
87 if (grid) 83 {
88 _info["login"] = netCfg.GetString("user_server_url"); 84 if (grid)
85 _info["login"] = netCfg.GetString("user_server_url");
89 else 86 else
90 _info["login"] = String.Format("http://127.0.0.1:{0}/", netCfg.GetString("http_listener_port")); 87 _info["login"] = String.Format("http://127.0.0.1:{0}/", netCfg.GetString("http_listener_port"));
91 IssueWarning(); 88 IssueWarning();
92 }
93 else
94 {
95 _info["login"] = "http://127.0.0.1:9000/";
96 IssueWarning();
97 }
98 } 89 }
99 catch (Exception) 90 else
100 { 91 {
101 _log.DebugFormat("[GridInfoService] cannot get grid info from {0}, using minimal defaults", configPath); 92 _info["login"] = "http://127.0.0.1:9000/";
93 IssueWarning();
102 } 94 }
103 } 95 }
96 catch (Exception)
97 {
98 _log.Debug("[GridInfoService] cannot get grid info from config source, using minimal defaults");
99 }
104 _log.InfoFormat("[GridInfoService] Grid info service initialized with {0} keys", _info.Count); 100 _log.InfoFormat("[GridInfoService] Grid info service initialized with {0} keys", _info.Count);
105 } 101 }
106 102
107 /// <summary> 103 /// <summary>
108 /// Default constructor, uses OpenSim.ini. 104 /// Default constructor, uses OpenSim.ini.
109 /// </summary> 105 /// </summary>
110 public GridInfoService() : this(Path.Combine(Util.configDir(), "OpenSim.ini")) 106 public GridInfoService() : this(new IniConfigSource(Path.Combine(Util.configDir(), "OpenSim.ini")))
111 { 107 {
112 } 108 }
113 109