diff options
clean up of startup config settings (command line args etc),
Now using the Nini configuration library (suggest we look into using this for the rest of our config handling, as it provides a standard interface for command line args, INI files, Xml files, .NET config files, and windows registry).
One IMPORTANT change is that to TO START GRIDMODE , you need to now use -gridmode=true .
Also need someone to test it under mono. (there is a dll that has been compiled under mono available, just hoping that we don't have to deal with separate dlls for windows and linux.
Diffstat (limited to 'OpenSim/Region/Application/OpenSimMain.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 73 |
1 files changed, 46 insertions, 27 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index fbd6790..c68f75e 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -29,6 +29,7 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.IO; | 30 | using System.IO; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using Nini.Config; | ||
32 | using OpenSim.Assets; | 33 | using OpenSim.Assets; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
@@ -39,7 +40,7 @@ using OpenSim.Framework.Servers; | |||
39 | using OpenSim.Framework.Types; | 40 | using OpenSim.Framework.Types; |
40 | using OpenSim.Framework.Configuration; | 41 | using OpenSim.Framework.Configuration; |
41 | using OpenSim.Physics.Manager; | 42 | using OpenSim.Physics.Manager; |
42 | 43 | ||
43 | using OpenSim.Region.ClientStack; | 44 | using OpenSim.Region.ClientStack; |
44 | using OpenSim.Region.Communications.Local; | 45 | using OpenSim.Region.Communications.Local; |
45 | using OpenSim.Region.Communications.OGS1; | 46 | using OpenSim.Region.Communications.OGS1; |
@@ -57,7 +58,6 @@ namespace OpenSim | |||
57 | { | 58 | { |
58 | public string m_physicsEngine; | 59 | public string m_physicsEngine; |
59 | public bool m_sandbox; | 60 | public bool m_sandbox; |
60 | public bool m_loginserver; | ||
61 | public bool user_accounts; | 61 | public bool user_accounts; |
62 | public bool m_gridLocalAsset; | 62 | public bool m_gridLocalAsset; |
63 | protected bool m_useConfigFile; | 63 | protected bool m_useConfigFile; |
@@ -70,18 +70,37 @@ namespace OpenSim | |||
70 | private bool m_silent; | 70 | private bool m_silent; |
71 | private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log"); | 71 | private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log"); |
72 | 72 | ||
73 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngineName, bool useConfigFile, bool silent, string configFileName) | 73 | public OpenSimMain(IConfigSource configSource) |
74 | :base( ) | 74 | : base() |
75 | { | ||
76 | IConfigSource startupSource = configSource; | ||
77 | string iniFile = startupSource.Configs["Startup"].GetString("inifile", "NA"); | ||
78 | if (iniFile != "NA") | ||
79 | { | ||
80 | //a ini is set to be used for startup settings | ||
81 | string iniFilePath = Path.Combine(Util.configDir(), iniFile); | ||
82 | if (File.Exists(iniFilePath)) | ||
83 | { | ||
84 | startupSource = new IniConfigSource(iniFilePath); | ||
85 | |||
86 | //enable follow line, if we want the original config source(normally commandline args) merged with ini file settings. | ||
87 | //in this case we have it so if both sources have the same named setting, command line value will overwrite the ini file value. | ||
88 | //(as if someone has bothered to enter a command line arg, we should take notice of it) | ||
89 | //startupSource.Merge(configSource); | ||
90 | } | ||
91 | } | ||
92 | ReadConfigSettings(startupSource); | ||
93 | } | ||
94 | |||
95 | protected void ReadConfigSettings(IConfigSource configSource) | ||
75 | { | 96 | { |
76 | m_useConfigFile = useConfigFile; | 97 | m_useConfigFile = configSource.Configs["Startup"].GetBoolean("configfile", false); |
77 | m_sandbox = sandBoxMode; | 98 | m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false); |
78 | m_loginserver = startLoginServer; | 99 | m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics"); |
79 | m_physicsEngine = physicsEngineName; | 100 | m_configFileName = configSource.Configs["Startup"].GetString("config", "simconfig.xml"); |
80 | m_configFileName = configFileName; | 101 | m_silent = configSource.Configs["Startup"].GetBoolean("noverbose", false); |
81 | m_silent = silent; | ||
82 | } | 102 | } |
83 | 103 | ||
84 | |||
85 | /// <summary> | 104 | /// <summary> |
86 | /// Performs initialisation of the scene, such as loading configuration from disk. | 105 | /// Performs initialisation of the scene, such as loading configuration from disk. |
87 | /// </summary> | 106 | /// </summary> |
@@ -91,7 +110,7 @@ namespace OpenSim | |||
91 | { | 110 | { |
92 | Directory.CreateDirectory(Util.logDir()); | 111 | Directory.CreateDirectory(Util.logDir()); |
93 | } | 112 | } |
94 | m_log = new LogBase(Path.Combine(Util.logDir(),m_logFilename), "Region", this, m_silent); | 113 | m_log = new LogBase(Path.Combine(Util.logDir(), m_logFilename), "Region", this, m_silent); |
95 | MainLog.Instance = m_log; | 114 | MainLog.Instance = m_log; |
96 | 115 | ||
97 | base.StartUp(); | 116 | base.StartUp(); |
@@ -103,11 +122,11 @@ namespace OpenSim | |||
103 | 122 | ||
104 | if (m_sandbox) | 123 | if (m_sandbox) |
105 | { | 124 | { |
106 | m_commsManager = new CommunicationsLocal( m_networkServersInfo, m_httpServer, m_assetCache); | 125 | m_commsManager = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache); |
107 | } | 126 | } |
108 | else | 127 | else |
109 | { | 128 | { |
110 | m_commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer , m_assetCache); | 129 | m_commsManager = new CommunicationsOGS1(m_networkServersInfo, m_httpServer, m_assetCache); |
111 | } | 130 | } |
112 | 131 | ||
113 | 132 | ||
@@ -129,15 +148,15 @@ namespace OpenSim | |||
129 | 148 | ||
130 | for (int i = 0; i < configFiles.Length; i++) | 149 | for (int i = 0; i < configFiles.Length; i++) |
131 | { | 150 | { |
132 | Console.WriteLine("Loading region config file"); | 151 | //Console.WriteLine("Loading region config file"); |
133 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]); | 152 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]); |
134 | 153 | ||
135 | UDPServer udpServer; | 154 | UDPServer udpServer; |
136 | Scene scene = SetupScene(regionInfo, out udpServer); | 155 | Scene scene = SetupScene(regionInfo, out udpServer); |
137 | 156 | ||
138 | m_localScenes.Add(scene); | 157 | m_localScenes.Add(scene); |
139 | 158 | ||
140 | 159 | ||
141 | m_udpServers.Add(udpServer); | 160 | m_udpServers.Add(udpServer); |
142 | m_regionData.Add(regionInfo); | 161 | m_regionData.Add(regionInfo); |
143 | } | 162 | } |
@@ -148,7 +167,7 @@ namespace OpenSim | |||
148 | this.m_udpServers[i].ServerListener(); | 167 | this.m_udpServers[i].ServerListener(); |
149 | } | 168 | } |
150 | 169 | ||
151 | 170 | ||
152 | } | 171 | } |
153 | 172 | ||
154 | protected override StorageManager CreateStorageManager(RegionInfo regionInfo) | 173 | protected override StorageManager CreateStorageManager(RegionInfo regionInfo) |
@@ -160,10 +179,10 @@ namespace OpenSim | |||
160 | { | 179 | { |
161 | return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer); | 180 | return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer); |
162 | } | 181 | } |
163 | 182 | ||
164 | protected override void Initialize() | 183 | protected override void Initialize() |
165 | { | 184 | { |
166 | m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", Path.Combine(Util.configDir(),"network_servers_information.xml")); | 185 | m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", Path.Combine(Util.configDir(), "network_servers_information.xml")); |
167 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; | 186 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; |
168 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); | 187 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); |
169 | } | 188 | } |
@@ -174,15 +193,15 @@ namespace OpenSim | |||
174 | { | 193 | { |
175 | Directory.CreateDirectory(Util.logDir()); | 194 | Directory.CreateDirectory(Util.logDir()); |
176 | } | 195 | } |
177 | 196 | ||
178 | return new LogBase((Path.Combine(Util.logDir(),m_logFilename)), "Region", this, m_silent); | 197 | return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, m_silent); |
179 | } | 198 | } |
180 | 199 | ||
181 | # region Setup methods | 200 | # region Setup methods |
182 | 201 | ||
183 | protected override PhysicsScene GetPhysicsScene( ) | 202 | protected override PhysicsScene GetPhysicsScene() |
184 | { | 203 | { |
185 | return GetPhysicsScene( m_physicsEngine ); | 204 | return GetPhysicsScene(m_physicsEngine); |
186 | } | 205 | } |
187 | 206 | ||
188 | private class SimStatusHandler : IStreamHandler | 207 | private class SimStatusHandler : IStreamHandler |
@@ -201,7 +220,7 @@ namespace OpenSim | |||
201 | { | 220 | { |
202 | get { return "GET"; } | 221 | get { return "GET"; } |
203 | } | 222 | } |
204 | 223 | ||
205 | public string Path | 224 | public string Path |
206 | { | 225 | { |
207 | get { return "/simstatus/"; } | 226 | get { return "/simstatus/"; } |