aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs392
1 files changed, 196 insertions, 196 deletions
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index 6fde140..38cfab5 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -1,196 +1,196 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Threading; 4using System.Threading;
5using System.IO; 5using System.IO;
6using OpenSim.Framework; 6using OpenSim.Framework;
7using Nini; 7using Nini;
8using Nini.Config; 8using Nini.Config;
9 9
10namespace OpenSim 10namespace OpenSim
11{ 11{
12 public class ConfigurationLoader 12 public class ConfigurationLoader
13 { 13 {
14 protected ConfigSettings m_configSettings; 14 protected ConfigSettings m_configSettings;
15 protected OpenSimConfigSource m_config; 15 protected OpenSimConfigSource m_config;
16 protected NetworkServersInfo m_networkServersInfo; 16 protected NetworkServersInfo m_networkServersInfo;
17 17
18 public ConfigurationLoader() 18 public ConfigurationLoader()
19 { 19 {
20 20
21 } 21 }
22 22
23 public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings, out NetworkServersInfo networkInfo) 23 public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings, out NetworkServersInfo networkInfo)
24 { 24 {
25 m_configSettings = configSettings = new ConfigSettings(); 25 m_configSettings = configSettings = new ConfigSettings();
26 m_networkServersInfo = networkInfo = new NetworkServersInfo(); 26 m_networkServersInfo = networkInfo = new NetworkServersInfo();
27 bool iniFileExists = false; 27 bool iniFileExists = false;
28 28
29 IConfig startupConfig = configSource.Configs["Startup"]; 29 IConfig startupConfig = configSource.Configs["Startup"];
30 30
31 string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini"); 31 string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");
32 Application.iniFilePath = Path.Combine(Util.configDir(), iniFileName); 32 Application.iniFilePath = Path.Combine(Util.configDir(), iniFileName);
33 33
34 string masterFileName = startupConfig.GetString("inimaster", ""); 34 string masterFileName = startupConfig.GetString("inimaster", "");
35 string masterfilePath = Path.Combine(Util.configDir(), masterFileName); 35 string masterfilePath = Path.Combine(Util.configDir(), masterFileName);
36 36
37 m_config = new OpenSimConfigSource(); 37 m_config = new OpenSimConfigSource();
38 m_config.Source = new IniConfigSource(); 38 m_config.Source = new IniConfigSource();
39 m_config.Source.Merge(DefaultConfig()); 39 m_config.Source.Merge(DefaultConfig());
40 40
41 //check for .INI file (either default or name passed in command line) 41 //check for .INI file (either default or name passed in command line)
42 if (File.Exists(masterfilePath)) 42 if (File.Exists(masterfilePath))
43 { 43 {
44 m_config.Source.Merge(new IniConfigSource(masterfilePath)); 44 m_config.Source.Merge(new IniConfigSource(masterfilePath));
45 } 45 }
46 46
47 if (File.Exists(Application.iniFilePath)) 47 if (File.Exists(Application.iniFilePath))
48 { 48 {
49 iniFileExists = true; 49 iniFileExists = true;
50 50
51 // From reading Nini's code, it seems that later merged keys replace earlier ones. 51 // From reading Nini's code, it seems that later merged keys replace earlier ones.
52 m_config.Source.Merge(new IniConfigSource(Application.iniFilePath)); 52 m_config.Source.Merge(new IniConfigSource(Application.iniFilePath));
53 } 53 }
54 else 54 else
55 { 55 {
56 // check for a xml config file 56 // check for a xml config file
57 Application.iniFilePath = Path.Combine(Util.configDir(), "OpenSim.xml"); 57 Application.iniFilePath = Path.Combine(Util.configDir(), "OpenSim.xml");
58 58
59 if (File.Exists(Application.iniFilePath)) 59 if (File.Exists(Application.iniFilePath))
60 { 60 {
61 iniFileExists = true; 61 iniFileExists = true;
62 62
63 m_config.Source = new XmlConfigSource(); 63 m_config.Source = new XmlConfigSource();
64 m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); 64 m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));
65 } 65 }
66 } 66 }
67 67
68 m_config.Source.Merge(configSource); 68 m_config.Source.Merge(configSource);
69 69
70 if (!iniFileExists) 70 if (!iniFileExists)
71 m_config.Save("OpenSim.ini"); 71 m_config.Save("OpenSim.ini");
72 72
73 ReadConfigSettings(); 73 ReadConfigSettings();
74 74
75 return m_config; 75 return m_config;
76 } 76 }
77 77
78 /// <summary> 78 /// <summary>
79 /// Setup a default config values in case they aren't present in the ini file 79 /// Setup a default config values in case they aren't present in the ini file
80 /// </summary> 80 /// </summary>
81 /// <returns></returns> 81 /// <returns></returns>
82 public static IConfigSource DefaultConfig() 82 public static IConfigSource DefaultConfig()
83 { 83 {
84 IConfigSource defaultConfig = new IniConfigSource(); 84 IConfigSource defaultConfig = new IniConfigSource();
85 85
86 { 86 {
87 IConfig config = defaultConfig.Configs["Startup"]; 87 IConfig config = defaultConfig.Configs["Startup"];
88 88
89 if (null == config) 89 if (null == config)
90 config = defaultConfig.AddConfig("Startup"); 90 config = defaultConfig.AddConfig("Startup");
91 91
92 config.Set("gridmode", false); 92 config.Set("gridmode", false);
93 config.Set("physics", "basicphysics"); 93 config.Set("physics", "basicphysics");
94 config.Set("meshing", "ZeroMesher"); 94 config.Set("meshing", "ZeroMesher");
95 config.Set("physical_prim", true); 95 config.Set("physical_prim", true);
96 config.Set("see_into_this_sim_from_neighbor", true); 96 config.Set("see_into_this_sim_from_neighbor", true);
97 config.Set("serverside_object_permissions", false); 97 config.Set("serverside_object_permissions", false);
98 config.Set("storage_plugin", "OpenSim.Data.SQLite.dll"); 98 config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
99 config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3"); 99 config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
100 config.Set("storage_prim_inventories", true); 100 config.Set("storage_prim_inventories", true);
101 config.Set("startup_console_commands_file", String.Empty); 101 config.Set("startup_console_commands_file", String.Empty);
102 config.Set("shutdown_console_commands_file", String.Empty); 102 config.Set("shutdown_console_commands_file", String.Empty);
103 config.Set("DefaultScriptEngine", "ScriptEngine.DotNetEngine"); 103 config.Set("DefaultScriptEngine", "ScriptEngine.DotNetEngine");
104 config.Set("asset_database", "sqlite"); 104 config.Set("asset_database", "sqlite");
105 config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); 105 config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
106 } 106 }
107 107
108 { 108 {
109 IConfig config = defaultConfig.Configs["StandAlone"]; 109 IConfig config = defaultConfig.Configs["StandAlone"];
110 110
111 if (null == config) 111 if (null == config)
112 config = defaultConfig.AddConfig("StandAlone"); 112 config = defaultConfig.AddConfig("StandAlone");
113 113
114 config.Set("accounts_authenticate", false); 114 config.Set("accounts_authenticate", false);
115 config.Set("welcome_message", "Welcome to OpenSimulator"); 115 config.Set("welcome_message", "Welcome to OpenSimulator");
116 config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll"); 116 config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll");
117 config.Set("inventory_source", ""); 117 config.Set("inventory_source", "");
118 config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll"); 118 config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
119 config.Set("user_source", ""); 119 config.Set("user_source", "");
120 config.Set("asset_plugin", "OpenSim.Data.SQLite.dll"); 120 config.Set("asset_plugin", "OpenSim.Data.SQLite.dll");
121 config.Set("asset_source", ""); 121 config.Set("asset_source", "");
122 config.Set("dump_assets_to_file", false); 122 config.Set("dump_assets_to_file", false);
123 } 123 }
124 124
125 { 125 {
126 IConfig config = defaultConfig.Configs["Network"]; 126 IConfig config = defaultConfig.Configs["Network"];
127 127
128 if (null == config) 128 if (null == config)
129 config = defaultConfig.AddConfig("Network"); 129 config = defaultConfig.AddConfig("Network");
130 130
131 config.Set("default_location_x", 1000); 131 config.Set("default_location_x", 1000);
132 config.Set("default_location_y", 1000); 132 config.Set("default_location_y", 1000);
133 config.Set("http_listener_port", NetworkServersInfo.DefaultHttpListenerPort); 133 config.Set("http_listener_port", NetworkServersInfo.DefaultHttpListenerPort);
134 config.Set("remoting_listener_port", NetworkServersInfo.RemotingListenerPort); 134 config.Set("remoting_listener_port", NetworkServersInfo.RemotingListenerPort);
135 config.Set("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); 135 config.Set("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString());
136 config.Set("grid_send_key", "null"); 136 config.Set("grid_send_key", "null");
137 config.Set("grid_recv_key", "null"); 137 config.Set("grid_recv_key", "null");
138 config.Set("user_server_url", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString()); 138 config.Set("user_server_url", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString());
139 config.Set("user_send_key", "null"); 139 config.Set("user_send_key", "null");
140 config.Set("user_recv_key", "null"); 140 config.Set("user_recv_key", "null");
141 config.Set("asset_server_url", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString()); 141 config.Set("asset_server_url", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString());
142 config.Set("inventory_server_url", "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString()); 142 config.Set("inventory_server_url", "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString());
143 config.Set("secure_inventory_server", "true"); 143 config.Set("secure_inventory_server", "true");
144 } 144 }
145 145
146 return defaultConfig; 146 return defaultConfig;
147 } 147 }
148 148
149 protected virtual void ReadConfigSettings() 149 protected virtual void ReadConfigSettings()
150 { 150 {
151 IConfig startupConfig = m_config.Source.Configs["Startup"]; 151 IConfig startupConfig = m_config.Source.Configs["Startup"];
152 152
153 if (startupConfig != null) 153 if (startupConfig != null)
154 { 154 {
155 m_configSettings.Standalone = !startupConfig.GetBoolean("gridmode"); 155 m_configSettings.Standalone = !startupConfig.GetBoolean("gridmode");
156 m_configSettings.PhysicsEngine = startupConfig.GetString("physics"); 156 m_configSettings.PhysicsEngine = startupConfig.GetString("physics");
157 m_configSettings.MeshEngineName = startupConfig.GetString("meshing"); 157 m_configSettings.MeshEngineName = startupConfig.GetString("meshing");
158 158
159 m_configSettings.PhysicalPrim = startupConfig.GetBoolean("physical_prim"); 159 m_configSettings.PhysicalPrim = startupConfig.GetBoolean("physical_prim");
160 160
161 m_configSettings.See_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor"); 161 m_configSettings.See_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor");
162 162
163 m_configSettings.StorageDll = startupConfig.GetString("storage_plugin"); 163 m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
164 if (m_configSettings.StorageDll == "OpenSim.DataStore.MonoSqlite.dll") 164 if (m_configSettings.StorageDll == "OpenSim.DataStore.MonoSqlite.dll")
165 { 165 {
166 m_configSettings.StorageDll = "OpenSim.Data.SQLite.dll"; 166 m_configSettings.StorageDll = "OpenSim.Data.SQLite.dll";
167 Console.WriteLine("WARNING: OpenSim.DataStore.MonoSqlite.dll is deprecated. Set storage_plugin to OpenSim.Data.SQLite.dll."); 167 Console.WriteLine("WARNING: OpenSim.DataStore.MonoSqlite.dll is deprecated. Set storage_plugin to OpenSim.Data.SQLite.dll.");
168 Thread.Sleep(3000); 168 Thread.Sleep(3000);
169 } 169 }
170 170
171 m_configSettings.StorageConnectionString = startupConfig.GetString("storage_connection_string"); 171 m_configSettings.StorageConnectionString = startupConfig.GetString("storage_connection_string");
172 m_configSettings.EstateConnectionString = startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString); 172 m_configSettings.EstateConnectionString = startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString);
173 m_configSettings.AssetStorage = startupConfig.GetString("asset_database"); 173 m_configSettings.AssetStorage = startupConfig.GetString("asset_database");
174 m_configSettings.ClientstackDll = startupConfig.GetString("clientstack_plugin"); 174 m_configSettings.ClientstackDll = startupConfig.GetString("clientstack_plugin");
175 } 175 }
176 176
177 IConfig standaloneConfig = m_config.Source.Configs["StandAlone"]; 177 IConfig standaloneConfig = m_config.Source.Configs["StandAlone"];
178 if (standaloneConfig != null) 178 if (standaloneConfig != null)
179 { 179 {
180 m_configSettings.StandaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate"); 180 m_configSettings.StandaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate");
181 m_configSettings.StandaloneWelcomeMessage = standaloneConfig.GetString("welcome_message"); 181 m_configSettings.StandaloneWelcomeMessage = standaloneConfig.GetString("welcome_message");
182 182
183 m_configSettings.StandaloneInventoryPlugin = standaloneConfig.GetString("inventory_plugin"); 183 m_configSettings.StandaloneInventoryPlugin = standaloneConfig.GetString("inventory_plugin");
184 m_configSettings.StandaloneInventorySource = standaloneConfig.GetString("inventory_source"); 184 m_configSettings.StandaloneInventorySource = standaloneConfig.GetString("inventory_source");
185 m_configSettings.StandaloneUserPlugin = standaloneConfig.GetString("userDatabase_plugin"); 185 m_configSettings.StandaloneUserPlugin = standaloneConfig.GetString("userDatabase_plugin");
186 m_configSettings.StandaloneUserSource = standaloneConfig.GetString("user_source"); 186 m_configSettings.StandaloneUserSource = standaloneConfig.GetString("user_source");
187 m_configSettings.StandaloneAssetPlugin = standaloneConfig.GetString("asset_plugin"); 187 m_configSettings.StandaloneAssetPlugin = standaloneConfig.GetString("asset_plugin");
188 m_configSettings.StandaloneAssetSource = standaloneConfig.GetString("asset_source"); 188 m_configSettings.StandaloneAssetSource = standaloneConfig.GetString("asset_source");
189 189
190 m_configSettings.DumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file"); 190 m_configSettings.DumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file");
191 } 191 }
192 192
193 m_networkServersInfo.loadFromConfiguration(m_config.Source); 193 m_networkServersInfo.loadFromConfiguration(m_config.Source);
194 } 194 }
195 } 195 }
196} 196}