Commit a9384250 authored by Langhammer, Jens's avatar Langhammer, Jens

deploy: fix values being unquoted, fix invalid variable being referenced in web deployment

parent 3d42bd55
Pipeline #4023 failed with stage
in 4 minutes and 23 seconds
......@@ -4,14 +4,14 @@ metadata:
name: {{ include "p2.fullname" . }}-config
data:
P2_DEBUG: 'false'
P2_ERROR_REPORT_ENABLED: {{ .Values.config.error_reporting }}
P2_ERROR_REPORT_ENABLED: {{ .Values.config.error_reporting | quote }}
P2_S3__BASE_DOMAIN: {{ (index .Values.ingress.hosts 0) | quote }}
# Set this to true if you only want to use external authentication
P2_EXTERNAL_AUTH_ONLY: {{ .Values.config.external_auth_only }}
P2_EXTERNAL_AUTH_ONLY: {{ .Values.config.external_auth_only | quote }}
# Callback URL: <base url>/_/oidc/callback/
# P2_OIDC__ENABLED: false
# P2_OIDC__CLIENT_ID: ""
# P2_OIDC__CLIENT_SECRET: ""
# P2_OIDC__AUTH_URL: ""
# P2_OIDC__TOKEN_URL: ""
# P2_OIDC__USER_URL: ""
# P2_OIDC__ENABLED: 'false'
# P2_OIDC__CLIENT_ID: ''
# P2_OIDC__CLIENT_SECRET: ''
# P2_OIDC__AUTH_URL: ''
# P2_OIDC__TOKEN_URL: ''
# P2_OIDC__USER_URL: ''
......@@ -70,7 +70,7 @@ spec:
name: media-storage
containers:
- name: {{ .Chart.Name }}
image: "docker.beryju.org/p2/server:{{ .Values.image.tag }}"
image: "docker.beryju.org/p2/server:{{ .Values.version }}"
imagePullPolicy: IfNotPresent
command:
- ./manage.py
......
......@@ -117,13 +117,6 @@ class ConfigLoader:
yield
self.__sub_dicts.pop()
def get(self, key: str, default=None) -> Any:
"""Get value from loaded config file"""
config_copy = self.__config
for sub in self.__sub_dicts:
config_copy = config_copy.get(sub, None)
return config_copy.get(key, default)
@property
def raw(self) -> dict:
"""Get raw config dictionary"""
......@@ -144,6 +137,10 @@ class ConfigLoader:
return default
return root
def y_bool(self, path: str, default=False) -> bool:
"""Wrapper for y that converts value into boolean"""
return str(self.y(path, default)).lower() == 'true'
CONFIG = ConfigLoader()
# pylint: disable=unused-argument
......
......@@ -27,10 +27,10 @@ from p2.lib.sentry import before_send
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = CONFIG.get('secret_key',
'48e9z8tw=_z0e#m*x70&)u%cgo8#=16uzdze&i8q=*#**)@cp&') # noqa Debug
SECRET_KEY = CONFIG.y('secret_key',
'48e9z8tw=_z0e#m*x70&)u%cgo8#=16uzdze&i8q=*#**)@cp&') # noqa Debug
DEBUG = CONFIG.get('debug')
DEBUG = CONFIG.y_bool('debug')
TEST = any('test' in arg for arg in sys.argv)
CORS_ORIGIN_ALLOW_ALL = DEBUG
......@@ -167,7 +167,7 @@ LOGIN_REDIRECT_URL = '/'
CRISPY_TEMPLATE_PACK = 'bootstrap4'
# Authentication - OIDC
OIDC_ENABLED = CONFIG.y('oidc.enabled')
OIDC_ENABLED = CONFIG.y_bool('oidc.enabled')
OIDC_RP_CLIENT_ID = CONFIG.y('oidc.client_id')
OIDC_RP_CLIENT_SECRET = CONFIG.y('oidc.client_secret')
OIDC_OP_AUTHORIZATION_ENDPOINT = CONFIG.y('oidc.auth_url')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment