Introduce public-endpoint setting

This commit is contained in:
Pelle Nilsson 2018-06-03 19:55:31 +02:00
parent 717837b35a
commit 9b2a56e467
3 changed files with 14 additions and 8 deletions

View File

@ -156,6 +156,12 @@ listen
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 application, when the source code has changed. Useful for
development. Only works with the internal webserver.

View File

@ -75,12 +75,7 @@ class SMTP(object):
self.isso = isso
self.conf = isso.conf.section("smtp")
gh = isso.conf.get("general", "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]
self.public_endpoint = isso.conf.get("server", "public-endpoint") or local("host")
# test SMTP connectivity
try:
@ -129,7 +124,7 @@ class SMTP(object):
rv.write("---\n")
if admin:
uri = self.general_host + "/id/%i" % comment["id"]
uri = self.public_endpoint + "/id/%i" % comment["id"]
key = self.isso.sign(comment["id"])
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))
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))
rv.write("Unsubscribe from this conversation: %s\n" % (uri + "/unsubscribe/" + quote(recipient) + "/" + key))

View File

@ -78,6 +78,11 @@ purge-after = 30d
# for details). Does not apply for uWSGI.
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.
# Only works with the internal webserver.
reload = off