mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Add modular configuration for Robust connectors
We can provide modular ini for connectors...
look for our configuration in the following places...
1) in the default ini/-inifile
2) in the named file (ConfigName) located in the configured directory
(see Robust[.HG].ini [Start] section for ConfigDirectory)
3) in the repository named in the connector (ConfigURL)
In this case, the file will be written into the configured
directory with the specified
See example connector/service @ https://github.com/BlueWall/SlipStream
for testing.
This commit is contained in:
@@ -39,8 +39,69 @@ namespace OpenSim.Server.Handlers.Base
|
||||
|
||||
public class ServiceConnector : IServiceConnector
|
||||
{
|
||||
public virtual string ConfigURL
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public virtual string ConfigName
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public virtual string ConfigFile
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public virtual IConfigSource Config
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public ServiceConnector(IConfigSource config, IHttpServer server, string configName)
|
||||
{
|
||||
}
|
||||
|
||||
// We call this from our plugin module to get our configuration
|
||||
public IConfig GetConfig()
|
||||
{
|
||||
IConfig config = null;
|
||||
config = ServerUtils.GetConfig(ConfigFile, ConfigName);
|
||||
|
||||
// Our file is not here? We can get one to bootstrap our plugin module
|
||||
if ( config == null )
|
||||
{
|
||||
IConfigSource remotesource = GetConfigSource();
|
||||
|
||||
if (remotesource != null)
|
||||
{
|
||||
IniConfigSource initialconfig = new IniConfigSource();
|
||||
initialconfig.Merge (remotesource);
|
||||
initialconfig.Save(ConfigFile);
|
||||
}
|
||||
|
||||
config = remotesource.Configs[ConfigName];
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
// We get our remote initial configuration for bootstrapping
|
||||
private IConfigSource GetConfigSource()
|
||||
{
|
||||
IConfigSource source = null;
|
||||
|
||||
source = ServerUtils.LoadInitialConfig(ConfigURL);
|
||||
|
||||
if (source == null)
|
||||
System.Console.WriteLine(String.Format ("Config Url: {0} Not found!", ConfigURL));
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user