Release 15 - Revamp #38
4 changed files with 13 additions and 8 deletions
|
@ -7,7 +7,7 @@
|
|||
https_port {$HTTPS_PORT}
|
||||
}
|
||||
|
||||
{$CADDY_HOST} {
|
||||
{$CADDY_HOSTS} {
|
||||
# the tls certificates
|
||||
tls {$DATADIR}/tls/server.pem {$DATADIR}/tls/server-key.pem
|
||||
route {
|
||||
|
|
|
@ -28,7 +28,9 @@ db:
|
|||
port: 5432
|
||||
caddy:
|
||||
# Webserver settings
|
||||
host: "localhost"
|
||||
hosts:
|
||||
- "localhost"
|
||||
- "127.0.0.1"
|
||||
http_port: 80
|
||||
https_port: 443
|
||||
logs:
|
||||
|
|
|
@ -125,11 +125,13 @@ AUTH_USER_MODEL = "app.User"
|
|||
SESSION_COOKIE_AGE = int(config["app"]["session_cookie_age"])
|
||||
CSRF_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
f"https://{config['caddy']['host']}",
|
||||
f"http://{config['caddy']['host']}",
|
||||
f"https://{config['caddy']['host']}:{config['caddy']['https_port']}",
|
||||
f"http://{config['caddy']['host']}:{config['caddy']['https_port']}"]
|
||||
CSRF_TRUSTED_ORIGINS = []
|
||||
|
||||
for host in config['caddy']['hosts']:
|
||||
CSRF_TRUSTED_ORIGINS.append(f"http://{host}")
|
||||
CSRF_TRUSTED_ORIGINS.append(f"https://{host}")
|
||||
CSRF_TRUSTED_ORIGINS.append(f"http://{host}:{config['caddy']['https_port']}")
|
||||
CSRF_TRUSTED_ORIGINS.append(f"https://{host}:{config['caddy']['https_port']}")
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/4.1/topics/i18n/
|
||||
|
|
|
@ -118,7 +118,8 @@ if __name__ == "__main__":
|
|||
# Caddy configuration via env
|
||||
environment_caddy = os.environ
|
||||
environment_caddy["DATADIR"] = str(data_directory.absolute())
|
||||
environment_caddy["CADDY_HOST"] = str(config["caddy"]["host"])
|
||||
environment_caddy["CADDY_HOSTS"] = ", ".join(config["caddy"]["hosts"])
|
||||
print(environment_caddy["CADDY_HOSTS"])
|
||||
environment_caddy["HTTP_PORT"] = str(config["caddy"]["http_port"])
|
||||
environment_caddy["HTTPS_PORT"] = str(config["caddy"]["https_port"])
|
||||
environment_caddy["APPLICATION_PORT"] = str(config["app"]["application_port"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue