diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 86c2abb..baf0fd3 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -43,6 +43,7 @@ using OpenSim.Framework.Statistics; | |||
43 | using OpenSim.Grid.Communications.OGS1; | 43 | using OpenSim.Grid.Communications.OGS1; |
44 | using OpenSim.Grid.Framework; | 44 | using OpenSim.Grid.Framework; |
45 | using OpenSim.Grid.UserServer.Modules; | 45 | using OpenSim.Grid.UserServer.Modules; |
46 | using Nini.Config; | ||
46 | 47 | ||
47 | namespace OpenSim.Grid.UserServer | 48 | namespace OpenSim.Grid.UserServer |
48 | { | 49 | { |
@@ -73,8 +74,25 @@ namespace OpenSim.Grid.UserServer | |||
73 | 74 | ||
74 | protected AvatarCreationModule m_appearanceModule; | 75 | protected AvatarCreationModule m_appearanceModule; |
75 | 76 | ||
77 | protected static string m_consoleType = "local"; | ||
78 | protected static IConfigSource m_config = null; | ||
79 | protected static string m_configFile = "UserServer_Config.xml"; | ||
80 | |||
76 | public static void Main(string[] args) | 81 | public static void Main(string[] args) |
77 | { | 82 | { |
83 | ArgvConfigSource argvSource = new ArgvConfigSource(args); | ||
84 | argvSource.AddSwitch("Startup", "console", "c"); | ||
85 | argvSource.AddSwitch("Startup", "xmlfile", "x"); | ||
86 | |||
87 | IConfig startupConfig = argvSource.Configs["Startup"]; | ||
88 | if (startupConfig != null) | ||
89 | { | ||
90 | m_consoleType = startupConfig.GetString("console", "local"); | ||
91 | m_configFile = startupConfig.GetString("xmlfile", "UserServer_Config.xml"); | ||
92 | } | ||
93 | |||
94 | m_config = argvSource; | ||
95 | |||
78 | XmlConfigurator.Configure(); | 96 | XmlConfigurator.Configure(); |
79 | 97 | ||
80 | m_log.Info("Launching UserServer..."); | 98 | m_log.Info("Launching UserServer..."); |
@@ -87,7 +105,18 @@ namespace OpenSim.Grid.UserServer | |||
87 | 105 | ||
88 | public OpenUser_Main() | 106 | public OpenUser_Main() |
89 | { | 107 | { |
90 | m_console = new LocalConsole("User"); | 108 | switch (m_consoleType) |
109 | { | ||
110 | case "rest": | ||
111 | m_console = new RemoteConsole("User"); | ||
112 | break; | ||
113 | case "basic": | ||
114 | m_console = new CommandConsole("User"); | ||
115 | break; | ||
116 | default: | ||
117 | m_console = new LocalConsole("User"); | ||
118 | break; | ||
119 | } | ||
91 | MainConsole.Instance = m_console; | 120 | MainConsole.Instance = m_console; |
92 | } | 121 | } |
93 | 122 | ||
@@ -125,10 +154,20 @@ namespace OpenSim.Grid.UserServer | |||
125 | 154 | ||
126 | protected virtual IInterServiceInventoryServices StartupCoreComponents() | 155 | protected virtual IInterServiceInventoryServices StartupCoreComponents() |
127 | { | 156 | { |
128 | Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); | 157 | Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), m_configFile))); |
129 | 158 | ||
130 | m_httpServer = new BaseHttpServer(Cfg.HttpPort); | 159 | m_httpServer = new BaseHttpServer(Cfg.HttpPort); |
131 | 160 | ||
161 | if (m_console is RemoteConsole) | ||
162 | { | ||
163 | RemoteConsole c = (RemoteConsole)m_console; | ||
164 | c.SetServer(m_httpServer); | ||
165 | IConfig netConfig = m_config.AddConfig("Network"); | ||
166 | netConfig.Set("ConsoleUser", Cfg.ConsoleUser); | ||
167 | netConfig.Set("ConsolePass", Cfg.ConsolePass); | ||
168 | c.ReadConfig(m_config); | ||
169 | } | ||
170 | |||
132 | RegisterInterface<CommandConsole>(m_console); | 171 | RegisterInterface<CommandConsole>(m_console); |
133 | RegisterInterface<UserConfig>(Cfg); | 172 | RegisterInterface<UserConfig>(Cfg); |
134 | 173 | ||