As per the suggestion on the mailing list, added support for a OpenSim.xml config file, instead of a ini file. INI files still work the same as they did before, just now if a ini file isn't found, it looks for a OpenSim.xml file (of course in xml format) and if found uses that.

Includes a OpenSim.Example.xml for reference (the default settings saved as a xml file).
0.6.0-stable
MW 2008-06-26 17:20:08 +00:00
parent 744b44dc8b
commit 682ec53420
11 changed files with 125 additions and 41 deletions

View File

@ -51,7 +51,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
IRegionLoader regionLoader; IRegionLoader regionLoader;
if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") if (openSim.ConfigSource.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
{ {
m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
regionLoader = new RegionLoaderFileSystem(); regionLoader = new RegionLoaderFileSystem();
@ -62,7 +62,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
regionLoader = new RegionLoaderWebServer(); regionLoader = new RegionLoaderWebServer();
} }
regionLoader.SetIniConfigSource(openSim.ConfigSource); regionLoader.SetIniConfigSource(openSim.ConfigSource.ConfigSource);
RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
openSim.ModuleLoader.LoadDefaultSharedModules(); openSim.ModuleLoader.LoadDefaultSharedModules();
@ -89,7 +89,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
IRegionLoader regionLoader; IRegionLoader regionLoader;
if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") if (openSim.ConfigSource.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
{ {
m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
regionLoader = new RegionLoaderFileSystem(); regionLoader = new RegionLoaderFileSystem();
@ -100,7 +100,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
regionLoader = new RegionLoaderWebServer(); regionLoader = new RegionLoaderWebServer();
} }
regionLoader.SetIniConfigSource(openSim.ConfigSource); regionLoader.SetIniConfigSource(openSim.ConfigSource.ConfigSource);
RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
for (int i = 0; i < regionsToLoad.Length; i++) for (int i = 0; i < regionsToLoad.Length; i++)
{ {

View File

@ -58,11 +58,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
try try
{ {
if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && if (openSim.ConfigSource.ConfigSource.Configs["RemoteAdmin"] != null &&
openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) openSim.ConfigSource.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
{ {
m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty); requiredPassword = openSim.ConfigSource.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty);
m_app = openSim; m_app = openSim;
m_httpd = openSim.HttpServer; m_httpd = openSim.HttpServer;

View File

@ -203,7 +203,7 @@ namespace OpenSim.ApplicationPlugins.Rest
try try
{ {
if ((_config = openSim.ConfigSource.Configs["RestPlugins"]) == null) if ((_config = openSim.ConfigSource.ConfigSource.Configs["RestPlugins"]) == null)
{ {
m_log.WarnFormat("{0} Rest Plugins not configured", MsgID); m_log.WarnFormat("{0} Rest Plugins not configured", MsgID);
return; return;
@ -225,7 +225,7 @@ namespace OpenSim.ApplicationPlugins.Rest
_prefix = _config.GetString("prefix", "/admin"); _prefix = _config.GetString("prefix", "/admin");
// Get plugin specific config // Get plugin specific config
_pluginConfig = openSim.ConfigSource.Configs[ConfigName]; _pluginConfig = openSim.ConfigSource.ConfigSource.Configs[ConfigName];
m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID); m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID);

View File

@ -31,7 +31,7 @@ namespace OpenSim.Framework
{ {
public interface IRegionLoader public interface IRegionLoader
{ {
void SetIniConfigSource(IniConfigSource configSource); void SetIniConfigSource(IConfigSource configSource);
RegionInfo[] LoadRegions(); RegionInfo[] LoadRegions();
} }
} }

View File

@ -33,9 +33,9 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
{ {
public class RegionLoaderFileSystem : IRegionLoader public class RegionLoaderFileSystem : IRegionLoader
{ {
private IniConfigSource m_configSouce; private IConfigSource m_configSouce;
public void SetIniConfigSource(IniConfigSource configSource) public void SetIniConfigSource(IConfigSource configSource)
{ {
m_configSouce = configSource; m_configSouce = configSource;
} }
@ -46,7 +46,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
try try
{ {
IniConfig startupConfig = (IniConfig)m_configSouce.Configs["Startup"]; IConfig startupConfig = (IConfig)m_configSouce.Configs["Startup"];
regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim(); regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
} }
catch (Exception) catch (Exception)

View File

@ -39,9 +39,9 @@ namespace OpenSim.Framework.RegionLoader.Web
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IniConfigSource m_configSouce; private IConfigSource m_configSouce;
public void SetIniConfigSource(IniConfigSource configSource) public void SetIniConfigSource(IConfigSource configSource)
{ {
m_configSouce = configSource; m_configSouce = configSource;
} }
@ -55,7 +55,7 @@ namespace OpenSim.Framework.RegionLoader.Web
} }
else else
{ {
IniConfig startupConfig = (IniConfig) m_configSouce.Configs["Startup"]; IConfig startupConfig = (IConfig) m_configSouce.Configs["Startup"];
string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim(); string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
if (url == String.Empty) if (url == String.Empty)
{ {

View File

@ -69,7 +69,7 @@ namespace OpenSim
protected override void ReadConfigSettings() protected override void ReadConfigSettings()
{ {
IConfig startupConfig = m_config.Configs["Startup"]; IConfig startupConfig = m_config.ConfigSource.Configs["Startup"];
if (startupConfig != null) if (startupConfig != null)
{ {
@ -528,7 +528,7 @@ namespace OpenSim
c = DefaultConfig().AddConfig(cmdparams[1]); c = DefaultConfig().AddConfig(cmdparams[1]);
string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3); string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
c.Set(cmdparams[2], _value); c.Set(cmdparams[2], _value);
m_config.Merge(c.ConfigSource); m_config.ConfigSource.Merge(c.ConfigSource);
m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " +
_value); _value);

View File

@ -107,9 +107,10 @@ namespace OpenSim
protected IConfigSource m_finalConfig = null; protected IConfigSource m_finalConfig = null;
protected IniConfigSource m_config; //protected IniConfigSource m_config;
protected OpenSimConfigSource m_config;
public IniConfigSource ConfigSource public OpenSimConfigSource ConfigSource
{ {
get { return m_config; } get { return m_config; }
set { m_config = value; } set { m_config = value; }
@ -168,27 +169,43 @@ namespace OpenSim
Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini"); Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini");
m_config = new IniConfigSource(); m_config = new OpenSimConfigSource();
m_config.ConfigSource = new IniConfigSource();
IConfigSource icong;
//check for .INI file (either default or name passed in command line) //check for .INI file (either default or name passed in command line)
if (File.Exists(Application.iniFilePath)) if (File.Exists(Application.iniFilePath))
{ {
m_config.Merge(new IniConfigSource(Application.iniFilePath)); m_config.ConfigSource.Merge(new IniConfigSource(Application.iniFilePath));
m_config.Merge(configSource); m_config.ConfigSource.Merge(configSource);
} }
else else
{ {
Application.iniFilePath = Path.Combine(Util.configDir(), Application.iniFilePath); Application.iniFilePath = Path.Combine(Util.configDir(), Application.iniFilePath);
if (File.Exists(Application.iniFilePath)) if (File.Exists(Application.iniFilePath))
{ {
m_config.Merge(new IniConfigSource(Application.iniFilePath)); m_config.ConfigSource.Merge(new IniConfigSource(Application.iniFilePath));
m_config.Merge(configSource); m_config.ConfigSource.Merge(configSource);
} }
else else
{ {
// no default config files, so set default values, and save it if (File.Exists("OpenSim.xml"))
m_config.Merge(DefaultConfig()); {
m_config.Merge(configSource); //chech for a xml config file
m_config.Save(Application.iniFilePath); Application.iniFilePath = "OpenSim.xml";
m_config.ConfigSource = new XmlConfigSource();
m_config.ConfigSource.Merge(new XmlConfigSource(Application.iniFilePath));
m_config.ConfigSource.Merge(configSource);
}
else
{
//Application.iniFilePath = "OpenSim.xml";
// m_config.ConfigSource = new XmlConfigSource();
// no default config files, so set default values, and save it
m_config.ConfigSource.Merge(DefaultConfig());
m_config.ConfigSource.Merge(configSource);
m_config.Save(Application.iniFilePath);
}
} }
} }
@ -277,7 +294,7 @@ namespace OpenSim
{ {
m_networkServersInfo = new NetworkServersInfo(); m_networkServersInfo = new NetworkServersInfo();
IConfig startupConfig = m_config.Configs["Startup"]; IConfig startupConfig = m_config.ConfigSource.Configs["Startup"];
if (startupConfig != null) if (startupConfig != null)
{ {
@ -306,7 +323,7 @@ namespace OpenSim
m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
} }
IConfig standaloneConfig = m_config.Configs["StandAlone"]; IConfig standaloneConfig = m_config.ConfigSource.Configs["StandAlone"];
if (standaloneConfig != null) if (standaloneConfig != null)
{ {
m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", false); m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", false);
@ -327,7 +344,7 @@ namespace OpenSim
m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
} }
m_networkServersInfo.loadFromConfiguration(m_config); m_networkServersInfo.loadFromConfiguration(m_config.ConfigSource);
} }
/// <summary> /// <summary>
@ -380,11 +397,11 @@ namespace OpenSim
m_httpServer.AddStreamHandler(new SimStatusHandler()); m_httpServer.AddStreamHandler(new SimStatusHandler());
} }
proxyUrl = ConfigSource.Configs["Network"].GetString("proxy_url", ""); proxyUrl = ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_url", "");
proxyOffset = Int32.Parse(ConfigSource.Configs["Network"].GetString("proxy_offset", "0")); proxyOffset = Int32.Parse(ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_offset", "0"));
// Create a ModuleLoader instance // Create a ModuleLoader instance
m_moduleLoader = new ModuleLoader(m_config); m_moduleLoader = new ModuleLoader(m_config.ConfigSource);
ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup");
foreach (TypeExtensionNode node in nodes) foreach (TypeExtensionNode node in nodes)
@ -569,7 +586,7 @@ namespace OpenSim
return return
new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
storageManager, m_httpServer, storageManager, m_httpServer,
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config, m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config.ConfigSource,
m_version); m_version);
} }
@ -618,7 +635,7 @@ namespace OpenSim
protected override PhysicsScene GetPhysicsScene() protected override PhysicsScene GetPhysicsScene()
{ {
return GetPhysicsScene(m_physicsEngine, m_meshEngineName, m_config); return GetPhysicsScene(m_physicsEngine, m_meshEngineName, m_config.ConfigSource);
} }
/// <summary> /// <summary>
@ -702,5 +719,24 @@ namespace OpenSim
regionnum = m_sceneManager.Scenes.Count; regionnum = m_sceneManager.Scenes.Count;
} }
} }
public class OpenSimConfigSource
{
public IConfigSource ConfigSource;
public void Save(string path)
{
if (ConfigSource is IniConfigSource)
{
IniConfigSource iniCon = (IniConfigSource)ConfigSource;
iniCon.Save(path);
}
else if (ConfigSource is XmlConfigSource)
{
XmlConfigSource xmlCon = (XmlConfigSource)ConfigSource;
xmlCon.Save(path);
}
}
}
} }

View File

@ -79,7 +79,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{ {
m_log.Info("[BALANCER] " + "Entering Initialize()"); m_log.Info("[BALANCER] " + "Entering Initialize()");
proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", ""); proxyURL = openSim.ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_url", "");
if (proxyURL.Length == 0) return; if (proxyURL.Length == 0) return;
StartTcpServer(); StartTcpServer();
@ -93,8 +93,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
simMain = openSim; simMain = openSim;
commandServer = openSim.HttpServer; commandServer = openSim.HttpServer;
proxyOffset = Int32.Parse(openSim.ConfigSource.Configs["Network"].GetString("proxy_offset", "0")); proxyOffset = Int32.Parse(openSim.ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_offset", "0"));
serializeDir = openSim.ConfigSource.Configs["Network"].GetString("serialize_dir", "/tmp/"); serializeDir = openSim.ConfigSource.ConfigSource.Configs["Network"].GetString("serialize_dir", "/tmp/");
commandServer.AddXmlRPCHandler("SerializeRegion", SerializeRegion); commandServer.AddXmlRPCHandler("SerializeRegion", SerializeRegion);
commandServer.AddXmlRPCHandler("DeserializeRegion_Move", DeserializeRegion_Move); commandServer.AddXmlRPCHandler("DeserializeRegion_Move", DeserializeRegion_Move);

View File

@ -72,7 +72,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
public void Initialise(OpenSimBase openSim) public void Initialise(OpenSimBase openSim)
{ {
m_log.Info("Starting proxy"); m_log.Info("Starting proxy");
string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", ""); string proxyURL = openSim.ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_url", "");
if (proxyURL.Length == 0) return; if (proxyURL.Length == 0) return;
uint port = (uint) Int32.Parse(proxyURL.Split(new char[] {':'})[2]); uint port = (uint) Int32.Parse(proxyURL.Split(new char[] {':'})[2]);

48
bin/OpenSim.Example.xml Normal file
View File

@ -0,0 +1,48 @@
<Nini>
<Section Name="Startup">
<Key Name="gridmode" Value="False" />
<Key Name="physics" Value="basicphysics" />
<Key Name="physical_prim" Value="True" />
<Key Name="see_into_this_sim_from_neighbor" Value="True" />
<Key Name="serverside_object_permissions" Value="False" />
<Key Name="storage_plugin" Value="OpenSim.Data.SQLite.dll" />
<Key Name="storage_connection_string" Value="URI=file:OpenSim.db,version=3" />
<Key Name="storage_prim_inventories" Value="True" />
<Key Name="startup_console_commands_file" Value="" />
<Key Name="shutdown_console_commands_file" Value="" />
<Key Name="script_engine" Value="OpenSim.Region.ScriptEngine.DotNetEngine.dll" />
<Key Name="asset_database" Value="sqlite" />
<Key Name="clientstack_plugin" Value="OpenSim.Region.ClientStack.LindenUDP.dll" />
</Section>
<Section Name="StandAlone">
<Key Name="accounts_authenticate" Value="False" />
<Key Name="welcome_message" Value="Welcome to OpenSimulator" />
<Key Name="inventory_plugin" Value="OpenSim.Data.SQLite.dll" />
<Key Name="inventory_source" Value="" />
<Key Name="userDatabase_plugin" Value="OpenSim.Data.SQLite.dll" />
<Key Name="user_source" Value="" />
<Key Name="asset_plugin" Value="OpenSim.Data.SQLite.dll" />
<Key Name="asset_source" Value="" />
<Key Name="dump_assets_to_file" Value="False" />
</Section>
<Section Name="Network">
<Key Name="default_location_x" Value="1000" />
<Key Name="default_location_y" Value="1000" />
<Key Name="http_listener_port" Value="9000" />
<Key Name="remoting_listener_port" Value="8895" />
<Key Name="grid_server_url" Value="http://127.0.0.1:8001" />
<Key Name="grid_send_key" Value="null" />
<Key Name="grid_recv_key" Value="null" />
<Key Name="user_server_url" Value="http://127.0.0.1:8002" />
<Key Name="user_send_key" Value="null" />
<Key Name="user_recv_key" Value="null" />
<Key Name="asset_server_url" Value="http://127.0.0.1:8003" />
<Key Name="inventory_server_url" Value="http://127.0.0.1:8004" />
</Section>
<Section Name="RemoteAdmin">
<Key Name="enabled" Value="false" />
</Section>
<Section Name="Voice">
<Key Name="enabled" Value="false" />
</Section>
</Nini>