parametrize site redirect URL
This commit is contained in:
parent
53a7fa90cb
commit
aac1e817bb
4 changed files with 4 additions and 2 deletions
|
@ -9,6 +9,7 @@ newcomment_polling = 60
|
|||
name = "My blog"
|
||||
url = http://blog.mydomain.com
|
||||
admin_email = admin@mydomain.com
|
||||
redirect = /redirect
|
||||
|
||||
[http]
|
||||
host = 127.0.0.1
|
||||
|
|
2
run.py
2
run.py
|
@ -105,7 +105,7 @@ def stacosys_server(config_pathname):
|
|||
)
|
||||
|
||||
# inject config parameters into flask
|
||||
app.config.update(SITE_TOKEN=conf.get(ConfigParameter.SITE_TOKEN))
|
||||
app.config.update(SITE_REDIRECT=conf.get(ConfigParameter.SITE_REDIRECT))
|
||||
logger.info(f"start interfaces {api} {form}")
|
||||
|
||||
# start Flask
|
||||
|
|
|
@ -35,6 +35,7 @@ class ConfigParameter(Enum):
|
|||
SITE_URL = "site.url"
|
||||
SITE_TOKEN = "site.token"
|
||||
SITE_ADMIN_EMAIL = "site.admin_email"
|
||||
SITE_REDIRECT = "site.redirect"
|
||||
|
||||
|
||||
class Config:
|
||||
|
|
|
@ -42,7 +42,7 @@ def new_form_comment():
|
|||
# add a row to Comment table
|
||||
dao.create_comment(url, author_name, author_site, author_gravatar, message)
|
||||
|
||||
return redirect("/redirect/", code=302)
|
||||
return redirect(app.config.get("SITE_REDIRECT"), code=302)
|
||||
|
||||
|
||||
def check_form_data(d):
|
||||
|
|
Loading…
Add table
Reference in a new issue