#29-add-admin-role #2
3 changed files with 10 additions and 5 deletions
|
@ -7,3 +7,4 @@ REDIRECT_URL="https://example.org/login-callback"
|
||||||
SECRET_KEY=
|
SECRET_KEY=
|
||||||
LOAD_INCLUSTER_CONFIG=false
|
LOAD_INCLUSTER_CONFIG=false
|
||||||
DATABASE_URL=sqlite:///database.db
|
DATABASE_URL=sqlite:///database.db
|
||||||
|
AUTHENTIK_BASEURL="https://sso.example.org/api/v3"
|
|
@ -1,11 +1,13 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def env_file(key: str):
|
def env_file(key: str):
|
||||||
file_env = os.environ.get(f"{key}_FILE")
|
file_env = os.environ.get(f"{key}_FILE")
|
||||||
if file_env and os.path.exists(file_env):
|
if file_env and os.path.exists(file_env):
|
||||||
return open(file_env).read().rstrip('\n')
|
return open(file_env).read().rstrip('\n')
|
||||||
return os.environ.get(key)
|
return os.environ.get(key)
|
||||||
|
|
||||||
|
|
||||||
SECRET_KEY = env_file("SECRET_KEY")
|
SECRET_KEY = env_file("SECRET_KEY")
|
||||||
|
|
||||||
HYDRA_CLIENT_ID = os.environ.get("HYDRA_CLIENT_ID")
|
HYDRA_CLIENT_ID = os.environ.get("HYDRA_CLIENT_ID")
|
||||||
|
@ -28,4 +30,7 @@ SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
# Set this to "true" to load the config from a Kubernetes serviceaccount
|
# Set this to "true" to load the config from a Kubernetes serviceaccount
|
||||||
# running in a Kubernetes pod. Set it to "false" to load the config from the
|
# running in a Kubernetes pod. Set it to "false" to load the config from the
|
||||||
# `KUBECONFIG` environment variable.
|
# `KUBECONFIG` environment variable.
|
||||||
LOAD_INCLUSTER_CONFIG = os.environ.get("LOAD_INCLUSTER_CONFIG").lower() == "true"
|
LOAD_INCLUSTER_CONFIG = os.environ.get(
|
||||||
|
"LOAD_INCLUSTER_CONFIG").lower() == "true"
|
||||||
|
|
||||||
|
AUTHENTIK_BASEURL = os.environ.get("AUTHENTIK_BASEURL")
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
from flask_jwt_extended import get_jwt
|
from flask_jwt_extended import get_jwt
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
from config import AUTHENTIK_BASEURL
|
||||||
from .error_handler import AuthentikError
|
from .error_handler import AuthentikError
|
||||||
|
|
||||||
AUTHENTIK_BASEURL = "https://dev.local-it.cloud/api/v3"
|
class AuthentikApi: # TODO: check if can be replaced with apispec generated api?
|
||||||
|
|
||||||
|
|
||||||
class AuthentikApi: # TODO: check if can be replaced with apispec generated api?
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __handleError(res):
|
def __handleError(res):
|
||||||
if res.status_code >= 400:
|
if res.status_code >= 400:
|
||||||
|
|
Loading…
Reference in a new issue