aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs183
1 files changed, 10 insertions, 173 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 61e6f09..93cc0a7 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -76,7 +76,7 @@ namespace OpenSim
76 /// </summary> 76 /// </summary>
77 protected const string DEFAULT_INV_BACKUP_FILENAME = "opensim_inv.tar.gz"; 77 protected const string DEFAULT_INV_BACKUP_FILENAME = "opensim_inv.tar.gz";
78 78
79 protected ConfigSettings m_configSettings = new ConfigSettings(); 79 protected ConfigSettings m_configSettings;
80 80
81 public ConfigSettings ConfigurationSettings 81 public ConfigSettings ConfigurationSettings
82 { 82 {
@@ -84,14 +84,15 @@ namespace OpenSim
84 set { m_configSettings = value; } 84 set { m_configSettings = value; }
85 } 85 }
86 86
87 protected ConfigurationLoader m_configLoader;
88
87 protected GridInfoService m_gridInfoService; 89 protected GridInfoService m_gridInfoService;
88 90
89 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); 91 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
90 protected List<RegionInfo> m_regionData = new List<RegionInfo>(); 92 protected List<RegionInfo> m_regionData = new List<RegionInfo>();
91 93
92 public ConsoleCommand CreateAccount = null; 94 public ConsoleCommand CreateAccount = null;
93 protected bool m_dumpAssetsToFile; 95
94
95 protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>(); 96 protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
96 97
97 /// <value> 98 /// <value>
@@ -138,178 +139,14 @@ namespace OpenSim
138 /// <param name="configSource"></param> 139 /// <param name="configSource"></param>
139 public OpenSimBase(IConfigSource configSource) : base() 140 public OpenSimBase(IConfigSource configSource) : base()
140 { 141 {
141 LoadConfigSettings(configSource); 142 m_configLoader = new ConfigurationLoader();
143 m_config = m_configLoader.LoadConfigSettings(configSource, out m_configSettings, out m_networkServersInfo);
144 ReadExtraConfigSettings();
142 } 145 }
143 146
144 protected void LoadConfigSettings(IConfigSource configSource) 147 protected virtual void ReadExtraConfigSettings()
145 { 148 {
146 bool iniFileExists = false;
147
148 IConfig startupConfig = configSource.Configs["Startup"];
149
150 string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");
151 Application.iniFilePath = Path.Combine(Util.configDir(), iniFileName);
152
153 string masterFileName = startupConfig.GetString("inimaster", "");
154 string masterfilePath = Path.Combine(Util.configDir(), masterFileName);
155
156 m_config = new OpenSimConfigSource();
157 m_config.Source = new IniConfigSource();
158 m_config.Source.Merge(DefaultConfig());
159
160 //check for .INI file (either default or name passed in command line)
161 if (File.Exists(masterfilePath))
162 {
163 m_config.Source.Merge(new IniConfigSource(masterfilePath));
164 }
165
166 if (File.Exists(Application.iniFilePath))
167 {
168 iniFileExists = true;
169
170 // From reading Nini's code, it seems that later merged keys replace earlier ones.
171 m_config.Source.Merge(new IniConfigSource(Application.iniFilePath));
172 }
173 else
174 {
175 // check for a xml config file
176 Application.iniFilePath = Path.Combine(Util.configDir(), "OpenSim.xml");
177
178 if (File.Exists(Application.iniFilePath))
179 {
180 iniFileExists = true;
181
182 m_config.Source = new XmlConfigSource();
183 m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));
184 }
185 }
186
187 m_config.Source.Merge(configSource);
188
189 if (!iniFileExists)
190 m_config.Save("OpenSim.ini");
191
192 ReadConfigSettings();
193 }
194
195 /// <summary>
196 /// Setup a default config values in case they aren't present in the ini file
197 /// </summary>
198 /// <returns></returns>
199 public static IConfigSource DefaultConfig()
200 {
201 IConfigSource defaultConfig = new IniConfigSource();
202
203 {
204 IConfig config = defaultConfig.Configs["Startup"];
205
206 if (null == config)
207 config = defaultConfig.AddConfig("Startup");
208
209 config.Set("gridmode", false);
210 config.Set("physics", "basicphysics");
211 config.Set("meshing", "ZeroMesher");
212 config.Set("physical_prim", true);
213 config.Set("see_into_this_sim_from_neighbor", true);
214 config.Set("serverside_object_permissions", false);
215 config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
216 config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
217 config.Set("storage_prim_inventories", true);
218 config.Set("startup_console_commands_file", String.Empty);
219 config.Set("shutdown_console_commands_file", String.Empty);
220 config.Set("DefaultScriptEngine", "ScriptEngine.DotNetEngine");
221 config.Set("asset_database", "sqlite");
222 config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
223 }
224
225 {
226 IConfig config = defaultConfig.Configs["StandAlone"];
227
228 if (null == config)
229 config = defaultConfig.AddConfig("StandAlone");
230
231 config.Set("accounts_authenticate", false);
232 config.Set("welcome_message", "Welcome to OpenSimulator");
233 config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll");
234 config.Set("inventory_source", "");
235 config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
236 config.Set("user_source", "");
237 config.Set("asset_plugin", "OpenSim.Data.SQLite.dll");
238 config.Set("asset_source", "");
239 config.Set("dump_assets_to_file", false);
240 }
241
242 {
243 IConfig config = defaultConfig.Configs["Network"];
244
245 if (null == config)
246 config = defaultConfig.AddConfig("Network");
247
248 config.Set("default_location_x", 1000);
249 config.Set("default_location_y", 1000);
250 config.Set("http_listener_port", NetworkServersInfo.DefaultHttpListenerPort);
251 config.Set("remoting_listener_port", NetworkServersInfo.RemotingListenerPort);
252 config.Set("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString());
253 config.Set("grid_send_key", "null");
254 config.Set("grid_recv_key", "null");
255 config.Set("user_server_url", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString());
256 config.Set("user_send_key", "null");
257 config.Set("user_recv_key", "null");
258 config.Set("asset_server_url", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString());
259 config.Set("inventory_server_url", "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString());
260 config.Set("secure_inventory_server", "true");
261 }
262
263 return defaultConfig;
264 }
265
266 protected virtual void ReadConfigSettings()
267 {
268 m_networkServersInfo = new NetworkServersInfo();
269
270 IConfig startupConfig = m_config.Source.Configs["Startup"];
271
272 if (startupConfig != null)
273 {
274 m_configSettings.Standalone = !startupConfig.GetBoolean("gridmode");
275 m_configSettings.PhysicsEngine = startupConfig.GetString("physics");
276 m_configSettings.MeshEngineName = startupConfig.GetString("meshing");
277
278 m_configSettings.PhysicalPrim = startupConfig.GetBoolean("physical_prim");
279
280 m_configSettings.See_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor");
281
282 m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
283 if (m_configSettings.StorageDll == "OpenSim.DataStore.MonoSqlite.dll")
284 {
285 m_configSettings.StorageDll = "OpenSim.Data.SQLite.dll";
286 Console.WriteLine("WARNING: OpenSim.DataStore.MonoSqlite.dll is deprecated. Set storage_plugin to OpenSim.Data.SQLite.dll.");
287 Thread.Sleep(3000);
288 }
289
290 m_configSettings.StorageConnectionString = startupConfig.GetString("storage_connection_string");
291 m_configSettings.EstateConnectionString = startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString);
292 m_configSettings.AssetStorage = startupConfig.GetString("asset_database");
293 m_configSettings.ClientstackDll = startupConfig.GetString("clientstack_plugin");
294 }
295
296 IConfig standaloneConfig = m_config.Source.Configs["StandAlone"];
297 if (standaloneConfig != null)
298 {
299 m_configSettings.StandaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate");
300 m_configSettings.StandaloneWelcomeMessage = standaloneConfig.GetString("welcome_message");
301
302 m_configSettings.StandaloneInventoryPlugin = standaloneConfig.GetString("inventory_plugin");
303 m_configSettings.StandaloneInventorySource = standaloneConfig.GetString("inventory_source");
304 m_configSettings.StandaloneUserPlugin = standaloneConfig.GetString("userDatabase_plugin");
305 m_configSettings.StandaloneUserSource = standaloneConfig.GetString("user_source");
306 m_configSettings.StandaloneAssetPlugin = standaloneConfig.GetString("asset_plugin");
307 m_configSettings.StandaloneAssetSource = standaloneConfig.GetString("asset_source");
308
309 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file");
310 }
311 149
312 m_networkServersInfo.loadFromConfiguration(m_config.Source);
313 } 150 }
314 151
315 protected void LoadPlugins() 152 protected void LoadPlugins()
@@ -384,7 +221,7 @@ namespace OpenSim
384 = new CommunicationsLocal( 221 = new CommunicationsLocal(
385 m_networkServersInfo, m_httpServer, m_assetCache, userService, userService, 222 m_networkServersInfo, m_httpServer, m_assetCache, userService, userService,
386 inventoryService, backendService, backendService, userService, 223 inventoryService, backendService, backendService, userService,
387 libraryRootFolder, m_dumpAssetsToFile); 224 libraryRootFolder, m_configSettings.DumpAssetsToFile);
388 225
389 // set up XMLRPC handler for client's initial login request message 226 // set up XMLRPC handler for client's initial login request message
390 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); 227 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
@@ -613,7 +450,7 @@ namespace OpenSim
613 return 450 return
614 new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, 451 new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
615 storageManager, m_httpServer, 452 storageManager, m_httpServer,
616 m_moduleLoader, m_dumpAssetsToFile, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, 453 m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source,
617 m_version); 454 m_version);
618 } 455 }
619 456