mirror of
https://github.com/etesync/server
synced 2025-02-17 19:01:59 +00:00
Allow non standard ports in CSRF_TRUSTED_ORIGINS
This commit is contained in:
parent
513abcce25
commit
221fd46174
@ -163,9 +163,17 @@ if any(os.path.isfile(x) for x in config_locations):
|
|||||||
ETEBASE_REDIS_URI = section.get("redis_uri")
|
ETEBASE_REDIS_URI = section.get("redis_uri")
|
||||||
|
|
||||||
if "allowed_hosts" in config:
|
if "allowed_hosts" in config:
|
||||||
|
if "ports" in config and "https_port" in config["ports"]:
|
||||||
|
https_port = ":" + config["ports"]["https_port"]
|
||||||
|
else:
|
||||||
|
https_port = ""
|
||||||
|
if "ports" in config and "http_port" in config["ports"]:
|
||||||
|
http_port = ":" + config["ports"]["http_port"]
|
||||||
|
else:
|
||||||
|
http_port = ""
|
||||||
ALLOWED_HOSTS = [y for x, y in config.items("allowed_hosts")]
|
ALLOWED_HOSTS = [y for x, y in config.items("allowed_hosts")]
|
||||||
CSRF_TRUSTED_ORIGINS = ["https://" + y for x, y in config.items("allowed_hosts")] + \
|
CSRF_TRUSTED_ORIGINS = ["https://" + y + https_port for x, y in config.items("allowed_hosts")] + \
|
||||||
["http://" + y for x, y in config.items("allowed_hosts")]
|
["http://" + y + http_port for x, y in config.items("allowed_hosts")]
|
||||||
|
|
||||||
if "database" in config:
|
if "database" in config:
|
||||||
DATABASES = {"default": {x.upper(): y for x, y in config.items("database")}}
|
DATABASES = {"default": {x.upper(): y for x, y in config.items("database")}}
|
||||||
|
Loading…
Reference in New Issue
Block a user