aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base
diff options
context:
space:
mode:
authorDev Random2014-02-25 08:24:22 -0500
committerJustin Clark-Casey (justincc)2014-02-26 23:39:45 +0000
commit6955190c7db2563927bc53fd47ed0b47094be45c (patch)
treef1194c1d68f79887df86abf766bcad104516879d /OpenSim/Server/Base
parentAdd some regression tests for previous commit 0e23374 (diff)
downloadopensim-SC_OLD-6955190c7db2563927bc53fd47ed0b47094be45c.zip
opensim-SC_OLD-6955190c7db2563927bc53fd47ed0b47094be45c.tar.gz
opensim-SC_OLD-6955190c7db2563927bc53fd47ed0b47094be45c.tar.bz2
opensim-SC_OLD-6955190c7db2563927bc53fd47ed0b47094be45c.tar.xz
Add Util method to load OpSys env vars
Diffstat (limited to 'OpenSim/Server/Base')
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs34
1 files changed, 12 insertions, 22 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 667cef8..8352ee2 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -49,9 +49,7 @@ namespace OpenSim.Server.Base
49 { 49 {
50 // Logger 50 // Logger
51 // 51 //
52 private static readonly ILog m_log = 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType);
55 53
56 // Command line args 54 // Command line args
57 // 55 //
@@ -72,11 +70,9 @@ namespace OpenSim.Server.Base
72 public ServicesServerBase(string prompt, string[] args) : base() 70 public ServicesServerBase(string prompt, string[] args) : base()
73 { 71 {
74 // Save raw arguments 72 // Save raw arguments
75 //
76 m_Arguments = args; 73 m_Arguments = args;
77 74
78 // Read command line 75 // Read command line
79 //
80 ArgvConfigSource argvConfig = new ArgvConfigSource(args); 76 ArgvConfigSource argvConfig = new ArgvConfigSource(args);
81 77
82 argvConfig.AddSwitch("Startup", "console", "c"); 78 argvConfig.AddSwitch("Startup", "console", "c");
@@ -86,7 +82,6 @@ namespace OpenSim.Server.Base
86 argvConfig.AddSwitch("Startup", "logconfig", "g"); 82 argvConfig.AddSwitch("Startup", "logconfig", "g");
87 83
88 // Automagically create the ini file name 84 // Automagically create the ini file name
89 //
90 string fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location); 85 string fileName = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
91 string iniFile = fileName + ".ini"; 86 string iniFile = fileName + ".ini";
92 string logConfig = null; 87 string logConfig = null;
@@ -95,19 +90,17 @@ namespace OpenSim.Server.Base
95 if (startupConfig != null) 90 if (startupConfig != null)
96 { 91 {
97 // Check if a file name was given on the command line 92 // Check if a file name was given on the command line
98 //
99 iniFile = startupConfig.GetString("inifile", iniFile); 93 iniFile = startupConfig.GetString("inifile", iniFile);
100 // 94
101 // Check if a prompt was given on the command line 95 // Check if a prompt was given on the command line
102 prompt = startupConfig.GetString("prompt", prompt); 96 prompt = startupConfig.GetString("prompt", prompt);
103 // 97
104 // Check for a Log4Net config file on the command line 98 // Check for a Log4Net config file on the command line
105 logConfig =startupConfig.GetString("logconfig",logConfig); 99 logConfig =startupConfig.GetString("logconfig", logConfig);
106 } 100 }
107 101
108 // Find out of the file name is a URI and remote load it 102 // Find out of the file name is a URI and remote load it if possible.
109 // if it's possible. Load it as a local file otherwise. 103 // Load it as a local file otherwise.
110 //
111 Uri configUri; 104 Uri configUri;
112 105
113 try 106 try
@@ -129,13 +122,14 @@ namespace OpenSim.Server.Base
129 Environment.Exit(1); 122 Environment.Exit(1);
130 } 123 }
131 124
132 // Merge the configuration from the command line into the 125 // Merge OpSys env vars
133 // loaded file 126 m_log.Info("[CONFIG]: Loading environment variables for Config");
134 // 127 Util.MergeEnvironmentToConfig(Config);
128
129 // Merge the configuration from the command line into the loaded file
135 Config.Merge(argvConfig); 130 Config.Merge(argvConfig);
136 131
137 // Refresh the startupConfig post merge 132 // Refresh the startupConfig post merge
138 //
139 if (Config.Configs["Startup"] != null) 133 if (Config.Configs["Startup"] != null)
140 { 134 {
141 startupConfig = Config.Configs["Startup"]; 135 startupConfig = Config.Configs["Startup"];
@@ -145,13 +139,10 @@ namespace OpenSim.Server.Base
145 139
146 prompt = startupConfig.GetString("Prompt", prompt); 140 prompt = startupConfig.GetString("Prompt", prompt);
147 141
148 // Allow derived classes to load config before the console is 142 // Allow derived classes to load config before the console is opened.
149 // opened.
150 //
151 ReadConfig(); 143 ReadConfig();
152 144
153 // Create main console 145 // Create main console
154 //
155 string consoleType = "local"; 146 string consoleType = "local";
156 if (startupConfig != null) 147 if (startupConfig != null)
157 consoleType = startupConfig.GetString("console", consoleType); 148 consoleType = startupConfig.GetString("console", consoleType);
@@ -195,7 +186,6 @@ namespace OpenSim.Server.Base
195 186
196 // Allow derived classes to perform initialization that 187 // Allow derived classes to perform initialization that
197 // needs to be done after the console has opened 188 // needs to be done after the console has opened
198 //
199 Initialise(); 189 Initialise();
200 } 190 }
201 191