proxy-plugins
This commit is contained in:
parent
b99c8aa704
commit
e4eb9f2b83
2 changed files with 34 additions and 0 deletions
|
|
@ -26,3 +26,16 @@ def at_webserver_root_creation(web_root):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return web_root
|
return web_root
|
||||||
|
|
||||||
|
|
||||||
|
def at_webproxy_root_creation(web_root):
|
||||||
|
"""
|
||||||
|
This function can modify the portal proxy service.
|
||||||
|
Args:
|
||||||
|
web_root (evennia.server.webserver.Website): The Evennia
|
||||||
|
Website application. Use .putChild() to add new
|
||||||
|
subdomains that are Portal-accessible over TCP;
|
||||||
|
primarily for new protocol development, but suitable
|
||||||
|
for other shenanigans.
|
||||||
|
"""
|
||||||
|
return web_root
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,16 @@ INFO_DICT = {
|
||||||
"webserver_internal": [],
|
"webserver_internal": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
WEB_PLUGINS_MODULE = mod_import(settings.WEB_PLUGINS_MODULE)
|
||||||
|
except ImportError:
|
||||||
|
WEB_PLUGINS_MODULE = None
|
||||||
|
INFO_DICT["errors"] = (
|
||||||
|
"WARNING: settings.WEB_PLUGINS_MODULE not found - "
|
||||||
|
"copy 'evennia/game_template/server/conf/web_plugins.py to mygame/server/conf."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
# Portal Service object
|
# Portal Service object
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
|
|
@ -380,6 +390,17 @@ if WEBSERVER_ENABLED:
|
||||||
|
|
||||||
web_root = Website(web_root, logPath=settings.HTTP_LOG_FILE)
|
web_root = Website(web_root, logPath=settings.HTTP_LOG_FILE)
|
||||||
web_root.is_portal = True
|
web_root.is_portal = True
|
||||||
|
|
||||||
|
if WEB_PLUGINS_MODULE:
|
||||||
|
try:
|
||||||
|
web_root = WEB_PLUGINS_MODULE.at_webproxy_root_creation(web_root)
|
||||||
|
except Exception as e: # Legacy user has not added an at_webproxy_root_creation function in existing web plugins file
|
||||||
|
INFO_DICT["errors"] = (
|
||||||
|
"WARNING: WEB_PLUGINS_MODULE is enabled but at_webproxy_root_creation() not found - "
|
||||||
|
"copy 'evennia/game_template/server/conf/web_plugins.py to mygame/server/conf."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
proxy_service = internet.TCPServer(proxyport, web_root, interface=interface)
|
proxy_service = internet.TCPServer(proxyport, web_root, interface=interface)
|
||||||
proxy_service.setName("EvenniaWebProxy%s:%s" % (ifacestr, proxyport))
|
proxy_service.setName("EvenniaWebProxy%s:%s" % (ifacestr, proxyport))
|
||||||
PORTAL.services.addService(proxy_service)
|
PORTAL.services.addService(proxy_service)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue