diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSimMain.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 79 |
1 files changed, 74 insertions, 5 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 8047b1b..75c7eb5 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -43,6 +43,7 @@ using OpenSim.Region.Communications.OGS1; | |||
43 | using OpenSim.Region.Environment; | 43 | using OpenSim.Region.Environment; |
44 | using OpenSim.Region.Environment.Scenes; | 44 | using OpenSim.Region.Environment.Scenes; |
45 | using OpenSim.Region.Physics.Manager; | 45 | using OpenSim.Region.Physics.Manager; |
46 | using OpenSim.Framework.Configuration; | ||
46 | using System.Globalization; | 47 | using System.Globalization; |
47 | using RegionInfo = OpenSim.Framework.Types.RegionInfo; | 48 | using RegionInfo = OpenSim.Framework.Types.RegionInfo; |
48 | 49 | ||
@@ -64,7 +65,7 @@ namespace OpenSim | |||
64 | 65 | ||
65 | protected ModuleLoader m_moduleLoader; | 66 | protected ModuleLoader m_moduleLoader; |
66 | protected LocalLoginService m_loginService; | 67 | protected LocalLoginService m_loginService; |
67 | private IConfigSource m_config; | 68 | private IniConfigSource m_config; |
68 | 69 | ||
69 | protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll"; | 70 | protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll"; |
70 | 71 | ||
@@ -105,19 +106,88 @@ namespace OpenSim | |||
105 | 106 | ||
106 | Util.changeUseExecutePathSetting(useExecutePath); | 107 | Util.changeUseExecutePathSetting(useExecutePath); |
107 | 108 | ||
109 | m_config = new IniConfigSource(); | ||
108 | //check for .INI file (either default or name passed in command line) | 110 | //check for .INI file (either default or name passed in command line) |
109 | string iniFilePath = Path.Combine(Util.configDir(), iniFile); | 111 | string iniFilePath = Path.Combine(Util.configDir(), iniFile); |
110 | if (File.Exists(iniFilePath)) | 112 | if (File.Exists(iniFilePath)) |
111 | { | 113 | { |
112 | m_config = new IniConfigSource(iniFilePath); | 114 | m_config.Merge(new IniConfigSource(iniFilePath)); |
113 | m_config.Merge(configSource); | 115 | m_config.Merge(configSource); |
114 | } | 116 | } |
115 | else | 117 | else |
116 | { | 118 | { |
117 | m_config = configSource; | 119 | // no default config files, so set default values, and save it |
120 | SetDefaultConfig(); | ||
121 | |||
122 | m_config.Merge(configSource); | ||
123 | |||
124 | m_config.Save(iniFilePath); | ||
118 | } | 125 | } |
119 | 126 | ||
120 | ReadConfigSettings(); | 127 | ReadConfigSettings(); |
128 | |||
129 | } | ||
130 | |||
131 | protected void SetDefaultConfig() | ||
132 | { | ||
133 | if (m_config.Configs["Startup"] == null) | ||
134 | m_config.AddConfig("Startup"); | ||
135 | IConfig config = m_config.Configs["Startup"]; | ||
136 | if (config != null) | ||
137 | { | ||
138 | config.Set("gridmode", false); | ||
139 | config.Set("physics", "basicphysics"); | ||
140 | config.Set("verbose", true); | ||
141 | config.Set("serverside_object_permissions", false); | ||
142 | |||
143 | config.Set("storage_plugin", "OpenSim.DataStore.NullStorage.dll"); | ||
144 | |||
145 | config.Set("startup_console_commands_file", ""); | ||
146 | config.Set("shutdown_console_commands_file", ""); | ||
147 | |||
148 | config.Set("script_engine", "DotNetEngine"); | ||
149 | |||
150 | config.Set("asset_database", "sqlite"); | ||
151 | |||
152 | // wtf? | ||
153 | config.Set("default_modules", true); | ||
154 | config.Set("default_shared_modules", true); | ||
155 | config.Set("except_modules", ""); | ||
156 | config.Set("except_shared_modules", ""); | ||
157 | } | ||
158 | |||
159 | if (m_config.Configs["StandAlone"] == null) | ||
160 | m_config.AddConfig("StandAlone"); | ||
161 | |||
162 | config = m_config.Configs["StandAlone"]; | ||
163 | if (config != null) | ||
164 | { | ||
165 | config.Set("accounts_authenticate", false); | ||
166 | config.Set("welcome_message", "Welcome to OpenSim"); | ||
167 | config.Set("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); | ||
168 | config.Set("userDatabase_plugin", "OpenSim.Framework.Data.SQLite.dll"); | ||
169 | config.Set("asset_plugin", "OpenSim.Framework.Data.SQLite.dll"); | ||
170 | config.Set("dump_assets_to_file", false); | ||
171 | } | ||
172 | |||
173 | if (m_config.Configs["Network"] == null) | ||
174 | m_config.AddConfig("Network"); | ||
175 | config = m_config.Configs["Network"]; | ||
176 | if (config != null) | ||
177 | { | ||
178 | config.Set("default_location_x", 1000); | ||
179 | config.Set("default_location_y", 1000); | ||
180 | |||
181 | config.Set("http_listener_port", NetworkServersInfo.DefaultHttpListenerPort); | ||
182 | config.Set("remoting_listener_port", NetworkServersInfo.RemotingListenerPort); | ||
183 | config.Set("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); | ||
184 | config.Set("grid_send_key", "null"); | ||
185 | config.Set("grid_recv_key", "null"); | ||
186 | config.Set("user_server_url", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString()); | ||
187 | config.Set("user_send_key", "null"); | ||
188 | config.Set("user_recv_key", "null"); | ||
189 | config.Set("asset_server_url", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString()); | ||
190 | } | ||
121 | } | 191 | } |
122 | 192 | ||
123 | protected void ReadConfigSettings() | 193 | protected void ReadConfigSettings() |
@@ -125,8 +195,7 @@ namespace OpenSim | |||
125 | m_networkServersInfo = new NetworkServersInfo(); | 195 | m_networkServersInfo = new NetworkServersInfo(); |
126 | 196 | ||
127 | IConfig startupConfig = m_config.Configs["Startup"]; | 197 | IConfig startupConfig = m_config.Configs["Startup"]; |
128 | 198 | if (startupConfig != null) | |
129 | if (startupConfig != null ) | ||
130 | { | 199 | { |
131 | m_sandbox = !startupConfig.GetBoolean("gridmode", false); | 200 | m_sandbox = !startupConfig.GetBoolean("gridmode", false); |
132 | m_physicsEngine = startupConfig.GetString("physics", "basicphysics"); | 201 | m_physicsEngine = startupConfig.GetString("physics", "basicphysics"); |