mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
Use environment rather than hardcoding strings, closes #36
This commit is contained in:
parent
06c97d75a0
commit
a128ed4803
@ -133,10 +133,14 @@ Il est possible de travailler sur une instance Docker.
|
|||||||
build: /chemin/vers/nk20
|
build: /chemin/vers/nk20
|
||||||
volumes:
|
volumes:
|
||||||
- /chemin/vers/nk20:/code/
|
- /chemin/vers/nk20:/code/
|
||||||
|
environment:
|
||||||
|
MAILING_LIST_DOMAIN: lists.example.com
|
||||||
|
NOTE_URL: nk20.example.com
|
||||||
|
DOMAIN: example.com
|
||||||
restart: always
|
restart: always
|
||||||
labels:
|
labels:
|
||||||
- traefik.domain=ndd.exemple.com
|
- traefik.domain=ndd.example.com
|
||||||
- traefik.frontend.rule=Host:ndd.exemple.com
|
- traefik.frontend.rule=Host:ndd.example.com
|
||||||
- traefik.port=8000
|
- traefik.port=8000
|
||||||
|
|
||||||
3. Enjoy :
|
3. Enjoy :
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
from .getenv import getenv
|
||||||
|
from .pretty_money import pretty_money
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
register.filter('getenv', getenv)
|
||||||
|
register.filter('pretty_money', pretty_money)
|
8
apps/note/templatetags/getenv.py
Normal file
8
apps/note/templatetags/getenv.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def getenv(value):
|
||||||
|
return os.getenv(value)
|
@ -1,8 +1,6 @@
|
|||||||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from django import template
|
|
||||||
|
|
||||||
|
|
||||||
def pretty_money(value):
|
def pretty_money(value):
|
||||||
if value % 100 == 0:
|
if value % 100 == 0:
|
||||||
@ -16,7 +14,3 @@ def pretty_money(value):
|
|||||||
abs(value) // 100,
|
abs(value) // 100,
|
||||||
abs(value) % 100,
|
abs(value) % 100,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
register = template.Library()
|
|
||||||
register.filter('pretty_money', pretty_money)
|
|
||||||
|
@ -51,12 +51,14 @@ except ImportError:
|
|||||||
if "cas" in INSTALLED_APPS:
|
if "cas" in INSTALLED_APPS:
|
||||||
MIDDLEWARE += ['cas.middleware.CASMiddleware']
|
MIDDLEWARE += ['cas.middleware.CASMiddleware']
|
||||||
# CAS Settings
|
# CAS Settings
|
||||||
|
CAS_SERVER_URL = "https://" + os.getenv("NOTE_URL") + "/cas/"
|
||||||
CAS_AUTO_CREATE_USER = False
|
CAS_AUTO_CREATE_USER = False
|
||||||
CAS_LOGO_URL = "/static/img/Saperlistpopette.png"
|
CAS_LOGO_URL = "/static/img/Saperlistpopette.png"
|
||||||
CAS_FAVICON_URL = "/static/favicon/favicon-32x32.png"
|
CAS_FAVICON_URL = "/static/favicon/favicon-32x32.png"
|
||||||
CAS_SHOW_SERVICE_MESSAGES = True
|
CAS_SHOW_SERVICE_MESSAGES = True
|
||||||
CAS_SHOW_POWERED = False
|
CAS_SHOW_POWERED = False
|
||||||
CAS_REDIRECT_TO_LOGIN_AFTER_LOGOUT = False
|
CAS_REDIRECT_TO_LOGIN_AFTER_LOGOUT = False
|
||||||
|
CAS_PROVIDE_URL_TO_LOGOUT = True
|
||||||
CAS_INFO_MESSAGES = {
|
CAS_INFO_MESSAGES = {
|
||||||
"cas_explained": {
|
"cas_explained": {
|
||||||
"message": _(
|
"message": _(
|
||||||
|
@ -39,7 +39,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|||||||
# EMAIL_HOST_USER = 'change_me'
|
# EMAIL_HOST_USER = 'change_me'
|
||||||
# EMAIL_HOST_PASSWORD = 'change_me'
|
# EMAIL_HOST_PASSWORD = 'change_me'
|
||||||
|
|
||||||
SERVER_EMAIL = 'no-reply@example.org'
|
SERVER_EMAIL = 'no-reply@' + os.getenv("DOMAIN")
|
||||||
|
|
||||||
# Security settings
|
# Security settings
|
||||||
SECURE_CONTENT_TYPE_NOSNIFF = False
|
SECURE_CONTENT_TYPE_NOSNIFF = False
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# Production Settings #
|
# Production Settings #
|
||||||
########################
|
########################
|
||||||
@ -37,7 +39,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|||||||
# EMAIL_HOST_USER = 'change_me'
|
# EMAIL_HOST_USER = 'change_me'
|
||||||
# EMAIL_HOST_PASSWORD = 'change_me'
|
# EMAIL_HOST_PASSWORD = 'change_me'
|
||||||
|
|
||||||
SERVER_EMAIL = 'no-reply@example.org'
|
SERVER_EMAIL = 'no-reply@' + os.getenv("DOMAIN")
|
||||||
|
|
||||||
# Security settings
|
# Security settings
|
||||||
SECURE_CONTENT_TYPE_NOSNIFF = False
|
SECURE_CONTENT_TYPE_NOSNIFF = False
|
||||||
@ -49,4 +51,4 @@ X_FRAME_OPTIONS = 'DENY'
|
|||||||
SESSION_COOKIE_AGE = 60 * 60 * 3
|
SESSION_COOKIE_AGE = 60 * 60 * 3
|
||||||
|
|
||||||
# CAS Client settings
|
# CAS Client settings
|
||||||
CAS_SERVER_URL = "https://note.crans.org/cas/"
|
CAS_SERVER_URL = "https://" + os.getenv("NOTE_URL") + "/cas/"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% load static i18n pretty_money static %}
|
{% load static i18n pretty_money static getenv %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
SPDX-License-Identifier: GPL-3.0-or-later
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
@ -128,7 +128,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
class="form-inline">
|
class="form-inline">
|
||||||
<span class="text-muted mr-1">
|
<span class="text-muted mr-1">
|
||||||
NoteKfet2020 —
|
NoteKfet2020 —
|
||||||
<a href="mailto:tresorie.bde@lists.crans.org"
|
<a href="mailto:tresorie.bde@{{ "MAILING_LIST_DOMAIN" | getenv }}"
|
||||||
class="text-muted">Nous contacter</a> —
|
class="text-muted">Nous contacter</a> —
|
||||||
</span>
|
</span>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
Loading…
Reference in New Issue
Block a user