mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-11-23 08:07:31 +00:00
Allow configuring the bind host address and port.
This commit is contained in:
parent
6dfceea6a0
commit
70c95f4b63
@ -4,3 +4,14 @@
|
|||||||
|
|
||||||
# A URL that this site can be accessed on. Do not include a trailing slash.
|
# A URL that this site can be accessed on. Do not include a trailing slash.
|
||||||
website_origin = "http://example.com:3000"
|
website_origin = "http://example.com:3000"
|
||||||
|
|
||||||
|
|
||||||
|
# ==============================
|
||||||
|
# These settings are optional.
|
||||||
|
# ==============================
|
||||||
|
|
||||||
|
# The address of the interface to bind to.
|
||||||
|
#bind_host = "0.0.0.0"
|
||||||
|
|
||||||
|
# The port to bind to.
|
||||||
|
#bind_port = 3000
|
||||||
|
6
index.py
6
index.py
@ -8,6 +8,7 @@ from extractors.manifest import extract_manifest
|
|||||||
from extractors.search import extract_search
|
from extractors.search import extract_search
|
||||||
from extractors.suggestions import extract_search_suggestions
|
from extractors.suggestions import extract_search_suggestions
|
||||||
from extractors.captions import extract_captions
|
from extractors.captions import extract_captions
|
||||||
|
import configuration
|
||||||
|
|
||||||
@cherrypy.tools.register("before_finalize", priority=60)
|
@cherrypy.tools.register("before_finalize", priority=60)
|
||||||
def custom_headers():
|
def custom_headers():
|
||||||
@ -126,7 +127,10 @@ class NewLeaf(object):
|
|||||||
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
cherrypy.response.headers["content-type"] = r.headers["content-type"]
|
||||||
return r
|
return r
|
||||||
|
|
||||||
cherrypy.config.update({"server.socket_port": 3000, "server.socket_host": "0.0.0.0"})
|
bind_port = getattr(configuration, "bind_port", 3000)
|
||||||
|
bind_host = getattr(configuration, "bind_host", "0.0.0.0")
|
||||||
|
|
||||||
|
cherrypy.config.update({"server.socket_port": bind_port, "server.socket_host": bind_host})
|
||||||
cherrypy.quickstart(NewLeaf(), "/", {
|
cherrypy.quickstart(NewLeaf(), "/", {
|
||||||
"/": {
|
"/": {
|
||||||
"tools.custom_headers.on": True
|
"tools.custom_headers.on": True
|
||||||
|
Loading…
Reference in New Issue
Block a user