diff options
author | BlueWall | 2012-10-03 16:07:11 -0400 |
---|---|---|
committer | BlueWall | 2012-10-03 16:07:11 -0400 |
commit | 3e71c71cbffb0de454759e2bbd0ff840dfa480bc (patch) | |
tree | d6cbdc998bd4d7f9309bb73866e1ebaf72cb1b1b | |
parent | Allow setting connection limits, part 2 (diff) | |
download | opensim-SC_OLD-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.zip opensim-SC_OLD-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.gz opensim-SC_OLD-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.bz2 opensim-SC_OLD-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.xz |
Add modular configuration for Robust connectors
We can provide modular ini for connectors...
look for our configuration in the following places...
1) in the default ini/-inifile
2) in the named file (ConfigName) located in the configured directory
(see Robust[.HG].ini [Start] section for ConfigDirectory)
3) in the repository named in the connector (ConfigURL)
In this case, the file will be written into the configured
directory with the specified
See example connector/service @ https://github.com/BlueWall/SlipStream
for testing.
-rw-r--r-- | OpenSim/Server/Base/ServerUtils.cs | 38 | ||||
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 8 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Base/ServerConnector.cs | 61 | ||||
-rw-r--r-- | bin/Robust.HG.ini.example | 4 | ||||
-rw-r--r-- | bin/Robust.ini.example | 5 |
5 files changed, 116 insertions, 0 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 42c82cf..4a696c4 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -33,6 +33,7 @@ using System.Xml.Serialization; | |||
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
35 | using log4net; | 35 | using log4net; |
36 | using Nini.Config; | ||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | 39 | ||
@@ -333,5 +334,42 @@ namespace OpenSim.Server.Base | |||
333 | 334 | ||
334 | return ret; | 335 | return ret; |
335 | } | 336 | } |
337 | |||
338 | public static IConfig GetConfig(string configFile, string configName) | ||
339 | { | ||
340 | IConfig config; | ||
341 | |||
342 | if (File.Exists(configFile)) | ||
343 | { | ||
344 | IConfigSource configsource = new IniConfigSource(configFile); | ||
345 | config = configsource.Configs[configName]; | ||
346 | } | ||
347 | else | ||
348 | config = null; | ||
349 | |||
350 | return config; | ||
351 | } | ||
352 | |||
353 | public static IConfigSource LoadInitialConfig(string url) | ||
354 | { | ||
355 | IConfigSource source = new XmlConfigSource(); | ||
356 | m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", url); | ||
357 | |||
358 | // The ini file path is a http URI | ||
359 | // Try to read it | ||
360 | try | ||
361 | { | ||
362 | XmlReader r = XmlReader.Create(url); | ||
363 | IConfigSource cs = new XmlConfigSource(r); | ||
364 | source.Merge(cs); | ||
365 | } | ||
366 | catch (Exception e) | ||
367 | { | ||
368 | m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), url); | ||
369 | Environment.Exit(1); | ||
370 | } | ||
371 | |||
372 | return source; | ||
373 | } | ||
336 | } | 374 | } |
337 | } | 375 | } |
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 0cff6ed..2f12288 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -64,6 +64,12 @@ namespace OpenSim.Server.Base | |||
64 | get { return m_Config; } | 64 | get { return m_Config; } |
65 | } | 65 | } |
66 | 66 | ||
67 | public string ConfigDirectory | ||
68 | { | ||
69 | get; | ||
70 | private set; | ||
71 | } | ||
72 | |||
67 | // Run flag | 73 | // Run flag |
68 | // | 74 | // |
69 | private bool m_Running = true; | 75 | private bool m_Running = true; |
@@ -153,6 +159,8 @@ namespace OpenSim.Server.Base | |||
153 | startupConfig = m_Config.Configs["Startup"]; | 159 | startupConfig = m_Config.Configs["Startup"]; |
154 | } | 160 | } |
155 | 161 | ||
162 | ConfigDirectory = startupConfig.GetString("ConfigDirectory", "."); | ||
163 | |||
156 | prompt = startupConfig.GetString("Prompt", prompt); | 164 | prompt = startupConfig.GetString("Prompt", prompt); |
157 | 165 | ||
158 | // Allow derived classes to load config before the console is | 166 | // Allow derived classes to load config before the console is |
diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 71876da..951cd89 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs | |||
@@ -39,8 +39,69 @@ namespace OpenSim.Server.Handlers.Base | |||
39 | 39 | ||
40 | public class ServiceConnector : IServiceConnector | 40 | public class ServiceConnector : IServiceConnector |
41 | { | 41 | { |
42 | public virtual string ConfigURL | ||
43 | { | ||
44 | get; | ||
45 | protected set; | ||
46 | } | ||
47 | |||
48 | public virtual string ConfigName | ||
49 | { | ||
50 | get; | ||
51 | protected set; | ||
52 | } | ||
53 | |||
54 | public virtual string ConfigFile | ||
55 | { | ||
56 | get; | ||
57 | protected set; | ||
58 | } | ||
59 | |||
60 | public virtual IConfigSource Config | ||
61 | { | ||
62 | get; | ||
63 | protected set; | ||
64 | } | ||
65 | |||
42 | public ServiceConnector(IConfigSource config, IHttpServer server, string configName) | 66 | public ServiceConnector(IConfigSource config, IHttpServer server, string configName) |
43 | { | 67 | { |
44 | } | 68 | } |
69 | |||
70 | // We call this from our plugin module to get our configuration | ||
71 | public IConfig GetConfig() | ||
72 | { | ||
73 | IConfig config = null; | ||
74 | config = ServerUtils.GetConfig(ConfigFile, ConfigName); | ||
75 | |||
76 | // Our file is not here? We can get one to bootstrap our plugin module | ||
77 | if ( config == null ) | ||
78 | { | ||
79 | IConfigSource remotesource = GetConfigSource(); | ||
80 | |||
81 | if (remotesource != null) | ||
82 | { | ||
83 | IniConfigSource initialconfig = new IniConfigSource(); | ||
84 | initialconfig.Merge (remotesource); | ||
85 | initialconfig.Save(ConfigFile); | ||
86 | } | ||
87 | |||
88 | config = remotesource.Configs[ConfigName]; | ||
89 | } | ||
90 | |||
91 | return config; | ||
92 | } | ||
93 | |||
94 | // We get our remote initial configuration for bootstrapping | ||
95 | private IConfigSource GetConfigSource() | ||
96 | { | ||
97 | IConfigSource source = null; | ||
98 | |||
99 | source = ServerUtils.LoadInitialConfig(ConfigURL); | ||
100 | |||
101 | if (source == null) | ||
102 | System.Console.WriteLine(String.Format ("Config Url: {0} Not found!", ConfigURL)); | ||
103 | |||
104 | return source; | ||
105 | } | ||
45 | } | 106 | } |
46 | } | 107 | } |
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 18094b7..995f181 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example | |||
@@ -23,6 +23,10 @@ | |||
23 | [Startup] | 23 | [Startup] |
24 | ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector,8002/OpenSim.Server.Handlers.dll:HGFriendsServerConnector,8002/OpenSim.Server.Handlers.dll:InstantMessageServerConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector" | 24 | ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector,8002/OpenSim.Server.Handlers.dll:HGFriendsServerConnector,8002/OpenSim.Server.Handlers.dll:InstantMessageServerConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector" |
25 | 25 | ||
26 | ; Modular configurations | ||
27 | ; Set path to directory for modular ini files... | ||
28 | ConfigDirectory = "/home/opensim/etc/Configs" | ||
29 | |||
26 | ; * This is common for all services, it's the network setup for the entire | 30 | ; * This is common for all services, it's the network setup for the entire |
27 | ; * server instance, if none is specified above | 31 | ; * server instance, if none is specified above |
28 | ; * | 32 | ; * |
diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 5a9d613..7b8e83d 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example | |||
@@ -15,6 +15,11 @@ | |||
15 | [Startup] | 15 | [Startup] |
16 | ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector" | 16 | ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector" |
17 | 17 | ||
18 | |||
19 | ; Modular configurations | ||
20 | ; Set path to directory for modular ini files... | ||
21 | ConfigDirectory = "/home/opensim/etc/Configs" | ||
22 | |||
18 | ; * This is common for all services, it's the network setup for the entire | 23 | ; * This is common for all services, it's the network setup for the entire |
19 | ; * server instance, if none is specified above | 24 | ; * server instance, if none is specified above |
20 | ; * | 25 | ; * |