diff --git a/zezere/default.conf b/zezere/default.conf index 42bf231..78fc39f 100644 --- a/zezere/default.conf +++ b/zezere/default.conf @@ -4,6 +4,7 @@ debug = no allowed_hosts = localhost, localhost.localdomain secure_cookie = yes # auth_method = local, oidc +# ov_base_url = [oidc.rp] # client_id = diff --git a/zezere/settings.py b/zezere/settings.py index 2008516..b42b882 100644 --- a/zezere/settings.py +++ b/zezere/settings.py @@ -164,9 +164,11 @@ ] MESSAGE_TAGS = { - messages.DEBUG: 'alert-secondary', - messages.INFO: 'alert-info', - messages.SUCCESS: 'alert-success', - messages.WARNING: 'alert-warning', - messages.ERROR: 'alert-danger', - } \ No newline at end of file + messages.DEBUG: "alert-secondary", + messages.INFO: "alert-info", + messages.SUCCESS: "alert-success", + messages.WARNING: "alert-warning", + messages.ERROR: "alert-danger", +} + +OV_BASE_URL = get("global", "ov_base_url", "OV_BASE_URL") diff --git a/zezere/views_portal.py b/zezere/views_portal.py index f32e1e5..693a130 100644 --- a/zezere/views_portal.py +++ b/zezere/views_portal.py @@ -12,6 +12,7 @@ from ipware import get_client_ip from zezere.models import Device, RunRequest, device_getter, SSHKey +from zezere.settings import OV_BASE_URL @login_required @@ -141,13 +142,13 @@ def add_ov(request): messages.error(request, "No ownership voucher provided") return redirect("portal_ov") - url = "http://localhost:8081/management/v1/ownership_voucher" + url = OV_BASE_URL headers = { "X-Number-Of-Vouchers": no_of_vouchers, "Content-Type": content_type, "Authorization": "Bearer", } - + try: response = requests.request("POST", url, headers=headers, data=payload) except requests.exceptions.RequestException as e: