Graft the REST console onto the grid server. Same procedure as with
the user server.arthursv
parent
c5bbcb04e0
commit
dd0234f500
|
@ -45,6 +45,8 @@ namespace OpenSim.Framework
|
|||
public string SimSendKey = String.Empty;
|
||||
public string UserRecvKey = String.Empty;
|
||||
public string UserSendKey = String.Empty;
|
||||
public string ConsoleUser = String.Empty;
|
||||
public string ConsolePass = String.Empty;
|
||||
|
||||
public GridConfig(string description, string filename)
|
||||
{
|
||||
|
@ -95,6 +97,12 @@ namespace OpenSim.Framework
|
|||
"Allow regions to register immediately upon grid server startup? true/false",
|
||||
"True",
|
||||
false);
|
||||
m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access user name [Default: disabled]", "0", false);
|
||||
|
||||
m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access password [Default: disabled]", "0", false);
|
||||
|
||||
}
|
||||
|
||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||
|
@ -140,6 +148,12 @@ namespace OpenSim.Framework
|
|||
case "allow_region_registration":
|
||||
AllowRegionRegistration = (bool)configuration_result;
|
||||
break;
|
||||
case "console_user":
|
||||
ConsoleUser = (string)configuration_result;
|
||||
break;
|
||||
case "console_pass":
|
||||
ConsolePass = (string)configuration_result;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
@ -46,6 +47,8 @@ namespace OpenSim.Grid.GridServer
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected GridConfig m_config;
|
||||
public string m_consoleType = "local";
|
||||
public IConfigSource m_configSource = null;
|
||||
|
||||
public GridConfig Config
|
||||
{
|
||||
|
@ -71,16 +74,36 @@ namespace OpenSim.Grid.GridServer
|
|||
|
||||
public GridServerBase()
|
||||
{
|
||||
m_console = new LocalConsole("Grid");
|
||||
MainConsole.Instance = m_console;
|
||||
}
|
||||
|
||||
protected override void StartupSpecific()
|
||||
{
|
||||
switch (m_consoleType)
|
||||
{
|
||||
case "rest":
|
||||
m_console = new RemoteConsole("Grid");
|
||||
break;
|
||||
case "basic":
|
||||
m_console = new CommandConsole("Grid");
|
||||
break;
|
||||
default:
|
||||
m_console = new LocalConsole("Grid");
|
||||
break;
|
||||
}
|
||||
MainConsole.Instance = m_console;
|
||||
m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
|
||||
|
||||
m_log.Info("[GRID]: Starting HTTP process");
|
||||
m_httpServer = new BaseHttpServer(m_config.HttpPort);
|
||||
if (m_console is RemoteConsole)
|
||||
{
|
||||
RemoteConsole c = (RemoteConsole)m_console;
|
||||
c.SetServer(m_httpServer);
|
||||
IConfig netConfig = m_configSource.AddConfig("Network");
|
||||
netConfig.Set("ConsoleUser", m_config.ConsoleUser);
|
||||
netConfig.Set("ConsolePass", m_config.ConsolePass);
|
||||
c.ReadConfig(m_configSource);
|
||||
}
|
||||
|
||||
LoadPlugins();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using log4net.Config;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Grid.GridServer
|
||||
{
|
||||
|
@ -33,10 +34,21 @@ namespace OpenSim.Grid.GridServer
|
|||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
ArgvConfigSource argvSource = new ArgvConfigSource(args);
|
||||
argvSource.AddSwitch("Startup", "console", "c");
|
||||
|
||||
XmlConfigurator.Configure();
|
||||
|
||||
GridServerBase app = new GridServerBase();
|
||||
|
||||
IConfig startupConfig = argvSource.Configs["Startup"];
|
||||
if (startupConfig != null)
|
||||
{
|
||||
app.m_consoleType = startupConfig.GetString("console", "local");
|
||||
}
|
||||
|
||||
app.m_configSource = argvSource;
|
||||
|
||||
// if (args.Length > 0 && args[0] == "-setuponly")
|
||||
// {
|
||||
// app.Config();
|
||||
|
|
|
@ -157,7 +157,6 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
if (m_console is RemoteConsole)
|
||||
{
|
||||
System.Console.WriteLine("Initialized REST console");
|
||||
RemoteConsole c = (RemoteConsole)m_console;
|
||||
c.SetServer(m_httpServer);
|
||||
IConfig netConfig = m_config.AddConfig("Network");
|
||||
|
|
|
@ -911,6 +911,7 @@
|
|||
<Reference name="OpenMetaverse.dll"/>
|
||||
<Reference name="XMLRPC.dll"/>
|
||||
<Reference name="log4net.dll"/>
|
||||
<Reference name="Nini.dll"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
|
|
Loading…
Reference in New Issue