mirror of
https://github.com/evennia/evennia.git
synced 2026-03-22 15:56:30 +01:00
Restructed terminal output from Server and Portal to allow external plugin-services to cleanly add their info at startup.
This commit is contained in:
parent
a30029472b
commit
d535d77811
2 changed files with 37 additions and 51 deletions
|
|
@ -84,46 +84,12 @@ class Portal(object):
|
|||
self.sessions = PORTAL_SESSIONS
|
||||
self.sessions.portal = self
|
||||
|
||||
print '\n' + '-'*50
|
||||
|
||||
# Make info output to the terminal.
|
||||
self.terminal_output()
|
||||
|
||||
print '-'*50
|
||||
|
||||
# set a callback if the server is killed abruptly,
|
||||
# by Ctrl-C, reboot etc.
|
||||
reactor.addSystemEventTrigger('before', 'shutdown', self.shutdown, _reactor_stopping=True)
|
||||
|
||||
self.game_running = False
|
||||
|
||||
def terminal_output(self):
|
||||
"""
|
||||
Outputs server startup info to the terminal.
|
||||
"""
|
||||
print ' %(servername)s Portal (%(version)s) started.' % {'servername': SERVERNAME, 'version': VERSION}
|
||||
if AMP_ENABLED:
|
||||
print " amp (to Server): %s" % AMP_PORT
|
||||
if TELNET_ENABLED:
|
||||
ports = ", ".join([str(port) for port in TELNET_PORTS])
|
||||
ifaces = ",".join([" %s" % iface for iface in TELNET_INTERFACES if iface != '0.0.0.0'])
|
||||
print " telnet%s: %s" % (ifaces, ports)
|
||||
if SSH_ENABLED:
|
||||
ports = ", ".join([str(port) for port in SSH_PORTS])
|
||||
ifaces = ",".join([" %s" % iface for iface in SSH_INTERFACES if iface != '0.0.0.0'])
|
||||
print " ssh%s: %s" % (ifaces, ports)
|
||||
if SSL_ENABLED:
|
||||
ports = ", ".join([str(port) for port in SSL_PORTS])
|
||||
ifaces = ",".join([" %s" % iface for iface in SSL_INTERFACES if iface != '0.0.0.0'])
|
||||
print " ssl%s: %s" % (ifaces, ports)
|
||||
if WEBSERVER_ENABLED:
|
||||
clientstring = ""
|
||||
if WEBCLIENT_ENABLED:
|
||||
clientstring = '/client'
|
||||
ports = ", ".join([str(port) for port in WEBSERVER_PORTS])
|
||||
ifaces = ",".join([" %s" % iface for iface in WEBSERVER_INTERFACES if iface != '0.0.0.0'])
|
||||
print " webserver%s%s: %s" % (clientstring, ifaces, ports)
|
||||
|
||||
def set_restart_mode(self, mode=None):
|
||||
"""
|
||||
This manages the flag file that tells the runner if the server should
|
||||
|
|
@ -179,12 +145,17 @@ application = service.Application('Portal')
|
|||
# and is where we store all the other services.
|
||||
PORTAL = Portal(application)
|
||||
|
||||
print '-' * 50
|
||||
print ' %(servername)s Portal (%(version)s) started.' % {'servername': SERVERNAME, 'version': VERSION}
|
||||
|
||||
if AMP_ENABLED:
|
||||
|
||||
# The AMP protocol handles the communication between
|
||||
# the portal and the mud server. Only reason to ever deactivate
|
||||
# it would be during testing and debugging.
|
||||
|
||||
print " amp (to Server): %s" % AMP_PORT
|
||||
|
||||
from src.server import amp
|
||||
|
||||
factory = amp.AmpClientFactory(PORTAL)
|
||||
|
|
@ -214,6 +185,8 @@ if TELNET_ENABLED:
|
|||
telnet_service.setName('EvenniaTelnet%s' % pstring)
|
||||
PORTAL.services.addService(telnet_service)
|
||||
|
||||
print ' telnet%s: %s' % (ifacestr, port)
|
||||
|
||||
if SSL_ENABLED:
|
||||
|
||||
# Start SSL game connection (requires PyOpenSSL).
|
||||
|
|
@ -233,6 +206,10 @@ if SSL_ENABLED:
|
|||
ssl_service.setName('EvenniaSSL%s' % pstring)
|
||||
PORTAL.services.addService(ssl_service)
|
||||
|
||||
print " ssl%s: %s" % (ifacestr, port)
|
||||
|
||||
|
||||
|
||||
if SSH_ENABLED:
|
||||
|
||||
# Start SSH game connections. Will create a keypair in evennia/game if necessary.
|
||||
|
|
@ -252,6 +229,8 @@ if SSH_ENABLED:
|
|||
ssh_service.setName('EvenniaSSH%s' % pstring)
|
||||
PORTAL.services.addService(ssh_service)
|
||||
|
||||
print " ssl%s: %s" % (ifacestr, port)
|
||||
|
||||
if WEBSERVER_ENABLED:
|
||||
|
||||
# Start a django-compatible webserver.
|
||||
|
|
@ -266,6 +245,7 @@ if WEBSERVER_ENABLED:
|
|||
# point our media resources to url /media
|
||||
web_root.putChild("media", static.File(settings.MEDIA_ROOT))
|
||||
|
||||
webclientstr = ""
|
||||
if WEBCLIENT_ENABLED:
|
||||
# create ajax client processes at /webclientdata
|
||||
from src.server.webclient import WebClient
|
||||
|
|
@ -273,6 +253,8 @@ if WEBSERVER_ENABLED:
|
|||
webclient.sessionhandler = PORTAL_SESSIONS
|
||||
web_root.putChild("webclientdata", webclient)
|
||||
|
||||
webclientstr = "/client"
|
||||
|
||||
web_site = server.Site(web_root, logPath=settings.HTTP_LOG_FILE)
|
||||
|
||||
for interface in WEBSERVER_INTERFACES:
|
||||
|
|
@ -286,10 +268,14 @@ if WEBSERVER_ENABLED:
|
|||
webserver.setName('EvenniaWebServer%s' % pstring)
|
||||
PORTAL.services.addService(webserver)
|
||||
|
||||
print " webserver%s%s: %s" % (webclientstr, ifacestr, port)
|
||||
|
||||
for plugin_module in PORTAL_SERVICES_PLUGIN_MODULES:
|
||||
# external plugin services to start
|
||||
plugin_module.start_plugin_services(PORTAL)
|
||||
|
||||
print '-' * 50 # end of terminal output
|
||||
|
||||
|
||||
if os.name == 'nt':
|
||||
# Windows only: Set PID file manually
|
||||
|
|
|
|||
|
|
@ -88,8 +88,6 @@ class Evennia(object):
|
|||
self.sessions = SESSIONS
|
||||
self.sessions.server = self
|
||||
|
||||
print '\n' + '-'*50
|
||||
|
||||
# Database-specific startup optimizations.
|
||||
self.sqlite3_prep()
|
||||
|
||||
|
|
@ -101,11 +99,6 @@ class Evennia(object):
|
|||
# initialize channelhandler
|
||||
channelhandler.CHANNELHANDLER.update()
|
||||
|
||||
# Make info output to the terminal.
|
||||
self.terminal_output()
|
||||
|
||||
print '-'*50
|
||||
|
||||
# set a callback if the server is killed abruptly,
|
||||
# by Ctrl-C, reboot etc.
|
||||
reactor.addSystemEventTrigger('before', 'shutdown', self.shutdown, _reactor_stopping=True)
|
||||
|
|
@ -207,13 +200,6 @@ class Evennia(object):
|
|||
if SERVER_STARTSTOP_MODULE:
|
||||
SERVER_STARTSTOP_MODULE.at_server_start()
|
||||
|
||||
def terminal_output(self):
|
||||
"""
|
||||
Outputs server startup info to the terminal.
|
||||
"""
|
||||
print ' %(servername)s Server (%(version)s) started.' % {'servername': SERVERNAME, 'version': VERSION}
|
||||
print ' amp (to Portal): %s' % AMP_PORT
|
||||
|
||||
def set_restart_mode(self, mode=None):
|
||||
"""
|
||||
This manages the flag file that tells the runner if the server is
|
||||
|
|
@ -311,12 +297,17 @@ application = service.Application('Evennia')
|
|||
# and is where we store all the other services.
|
||||
EVENNIA = Evennia(application)
|
||||
|
||||
# The AMP protocol handles the communication between
|
||||
# the portal and the mud server. Only reason to ever deactivate
|
||||
# it would be during testing and debugging.
|
||||
print '-' * 50
|
||||
print ' %(servername)s Server (%(version)s) started.' % {'servername': SERVERNAME, 'version': VERSION}
|
||||
|
||||
if AMP_ENABLED:
|
||||
|
||||
# The AMP protocol handles the communication between
|
||||
# the portal and the mud server. Only reason to ever deactivate
|
||||
# it would be during testing and debugging.
|
||||
|
||||
print ' amp (to Portal): %s' % AMP_PORT
|
||||
|
||||
from src.server import amp
|
||||
|
||||
factory = amp.AmpServerFactory(EVENNIA)
|
||||
|
|
@ -328,6 +319,8 @@ if IRC_ENABLED:
|
|||
|
||||
# IRC channel connections
|
||||
|
||||
print ' irc enabled'
|
||||
|
||||
from src.comms import irc
|
||||
irc.connect_all()
|
||||
|
||||
|
|
@ -335,12 +328,17 @@ if IMC2_ENABLED:
|
|||
|
||||
# IMC2 channel connections
|
||||
|
||||
print ' imc2 enabled'
|
||||
|
||||
from src.comms import imc2
|
||||
imc2.connect_all()
|
||||
|
||||
if RSS_ENABLED:
|
||||
|
||||
# RSS feed channel connections
|
||||
|
||||
print ' rss enabled'
|
||||
|
||||
from src.comms import rss
|
||||
rss.connect_all()
|
||||
|
||||
|
|
@ -348,6 +346,8 @@ for plugin_module in SERVER_SERVICES_PLUGIN_MODULES:
|
|||
# external plugin protocols
|
||||
plugin_module.start_plugin_services(EVENNIA)
|
||||
|
||||
print '-' * 50 # end of terminal output
|
||||
|
||||
# clear server startup mode
|
||||
ServerConfig.objects.conf("server_starting_mode", delete=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue