aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorBlueWall2011-11-19 11:01:51 -0500
committerBlueWall2011-11-23 10:11:47 -0500
commitd4e3a7fe81a155be841bc0d182aa7a14083ffa3e (patch)
tree917e7b363a879dcc45035f917f90408638327da6 /OpenSim
parentImprove the error messages returned if the HelloNeighbour call fails. (diff)
downloadopensim-SC_OLD-d4e3a7fe81a155be841bc0d182aa7a14083ffa3e.zip
opensim-SC_OLD-d4e3a7fe81a155be841bc0d182aa7a14083ffa3e.tar.gz
opensim-SC_OLD-d4e3a7fe81a155be841bc0d182aa7a14083ffa3e.tar.bz2
opensim-SC_OLD-d4e3a7fe81a155be841bc0d182aa7a14083ffa3e.tar.xz
Shell Environment Variables in config
Adding updated Nini and support to use shell environment variables in OpenSimulator configuration. Nini @ https://github.com/BlueWall/Nini-Dev
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs20
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs9
-rw-r--r--OpenSim/Tests/ConfigurationLoaderTest.cs4
3 files changed, 30 insertions, 3 deletions
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index d0f6ab7..4a7c8b0 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -70,7 +70,7 @@ namespace OpenSim
70 /// <param name="networkInfo"></param> 70 /// <param name="networkInfo"></param>
71 /// <returns>A configuration that gets passed to modules</returns> 71 /// <returns>A configuration that gets passed to modules</returns>
72 public OpenSimConfigSource LoadConfigSettings( 72 public OpenSimConfigSource LoadConfigSettings(
73 IConfigSource argvSource, out ConfigSettings configSettings, 73 IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
74 out NetworkServersInfo networkInfo) 74 out NetworkServersInfo networkInfo)
75 { 75 {
76 m_configSettings = configSettings = new ConfigSettings(); 76 m_configSettings = configSettings = new ConfigSettings();
@@ -195,6 +195,24 @@ namespace OpenSim
195 // Make sure command line options take precedence 195 // Make sure command line options take precedence
196 m_config.Source.Merge(argvSource); 196 m_config.Source.Merge(argvSource);
197 197
198
199 IConfig enVars = m_config.Source.Configs["Environment"];
200
201 if( enVars != null )
202 {
203 string[] env_keys = enVars.GetKeys();
204
205 foreach ( string key in env_keys )
206 {
207 envConfigSource.AddEnv(key, string.Empty);
208 }
209
210 envConfigSource.LoadEnv();
211 m_config.Source.Merge(envConfigSource);
212 m_config.Source.ExpandKeyValues();
213 }
214
215
198 ReadConfigSettings(); 216 ReadConfigSettings();
199 217
200 return m_config; 218 return m_config;
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 553786b..0a78df2 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -108,6 +108,13 @@ namespace OpenSim
108 get { return m_clientServers; } 108 get { return m_clientServers; }
109 } 109 }
110 110
111 protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource();
112
113 public EnvConfigSource envConfigSource
114 {
115 get { return m_EnvConfigSource; }
116 }
117
111 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); 118 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
112 119
113 public uint HttpServerPort 120 public uint HttpServerPort
@@ -142,7 +149,7 @@ namespace OpenSim
142 protected virtual void LoadConfigSettings(IConfigSource configSource) 149 protected virtual void LoadConfigSettings(IConfigSource configSource)
143 { 150 {
144 m_configLoader = new ConfigurationLoader(); 151 m_configLoader = new ConfigurationLoader();
145 m_config = m_configLoader.LoadConfigSettings(configSource, out m_configSettings, out m_networkServersInfo); 152 m_config = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo);
146 ReadExtraConfigSettings(); 153 ReadExtraConfigSettings();
147 } 154 }
148 155
diff --git a/OpenSim/Tests/ConfigurationLoaderTest.cs b/OpenSim/Tests/ConfigurationLoaderTest.cs
index c777acc..067264d 100644
--- a/OpenSim/Tests/ConfigurationLoaderTest.cs
+++ b/OpenSim/Tests/ConfigurationLoaderTest.cs
@@ -109,11 +109,13 @@ namespace OpenSim.Tests
109 // Prepare call to ConfigurationLoader.LoadConfigSettings() 109 // Prepare call to ConfigurationLoader.LoadConfigSettings()
110 ConfigurationLoader cl = new ConfigurationLoader(); 110 ConfigurationLoader cl = new ConfigurationLoader();
111 IConfigSource argvSource = new IniConfigSource(); 111 IConfigSource argvSource = new IniConfigSource();
112 EnvConfigSource envConfigSource = new EnvConfigSource();
112 argvSource.AddConfig("Startup").Set("inifile", mainIniFile); 113 argvSource.AddConfig("Startup").Set("inifile", mainIniFile);
113 ConfigSettings configSettings; 114 ConfigSettings configSettings;
114 NetworkServersInfo networkInfo; 115 NetworkServersInfo networkInfo;
115 116
116 OpenSimConfigSource source = cl.LoadConfigSettings(argvSource, out configSettings, out networkInfo); 117 OpenSimConfigSource source = cl.LoadConfigSettings(argvSource, envConfigSource,
118 out configSettings, out networkInfo);
117 119
118 // Remove default config 120 // Remove default config
119 config = source.Source.Configs["Startup"]; 121 config = source.Source.Configs["Startup"];