Introduce public-endpoint setting

pull/443/head
Pelle Nilsson 6 years ago
parent 717837b35a
commit 9b2a56e467

@ -156,6 +156,12 @@ listen
Does not apply for `uWSGI`. Does not apply for `uWSGI`.
public-endpoint
public URL that Isso is accessed from by end users. Should always be
a http:// or https:// absolute address. If left blank, automatic
detection is attempted. Normally only needs to be specified if
different than the `listen` setting.
reload reload
reload application, when the source code has changed. Useful for reload application, when the source code has changed. Useful for
development. Only works with the internal webserver. development. Only works with the internal webserver.

@ -75,12 +75,7 @@ class SMTP(object):
self.isso = isso self.isso = isso
self.conf = isso.conf.section("smtp") self.conf = isso.conf.section("smtp")
gh = isso.conf.get("general", "host") self.public_endpoint = isso.conf.get("server", "public-endpoint") or local("host")
if type(gh) == str:
self.general_host = gh
#if gh is not a string then gh is a list
else:
self.general_host = gh[0]
# test SMTP connectivity # test SMTP connectivity
try: try:
@ -129,7 +124,7 @@ class SMTP(object):
rv.write("---\n") rv.write("---\n")
if admin: if admin:
uri = self.general_host + "/id/%i" % comment["id"] uri = self.public_endpoint + "/id/%i" % comment["id"]
key = self.isso.sign(comment["id"]) key = self.isso.sign(comment["id"])
rv.write("Delete comment: %s\n" % (uri + "/delete/" + key)) rv.write("Delete comment: %s\n" % (uri + "/delete/" + key))
@ -138,7 +133,7 @@ class SMTP(object):
rv.write("Activate comment: %s\n" % (uri + "/activate/" + key)) rv.write("Activate comment: %s\n" % (uri + "/activate/" + key))
else: else:
uri = self.general_host + "/id/%i" % parent_comment["id"] uri = self.public_endpoint + "/id/%i" % parent_comment["id"]
key = self.isso.sign(('unsubscribe', recipient)) key = self.isso.sign(('unsubscribe', recipient))
rv.write("Unsubscribe from this conversation: %s\n" % (uri + "/unsubscribe/" + quote(recipient) + "/" + key)) rv.write("Unsubscribe from this conversation: %s\n" % (uri + "/unsubscribe/" + quote(recipient) + "/" + key))

@ -78,6 +78,11 @@ purge-after = 30d
# for details). Does not apply for uWSGI. # for details). Does not apply for uWSGI.
listen = http://localhost:8080 listen = http://localhost:8080
# public URL that Isso is accessed from by end users. Should always be a
# http:// or https:// absolute address. If left blank, automatic detection is
# attempted.
public-endpoint =
# reload application, when the source code has changed. Useful for development. # reload application, when the source code has changed. Useful for development.
# Only works with the internal webserver. # Only works with the internal webserver.
reload = off reload = off

Loading…
Cancel
Save