Change KRATOS_URL to KRATOS_ADMIN_URL and HYDRA_URL to HYDRA_PUBLIC_URL for clarity

This commit is contained in:
Maarten de Waard 2022-04-04 14:24:30 +02:00
parent 0074fee909
commit a7fb3ab28d
No known key found for this signature in database
GPG key ID: 1D3E893A657CC8DA
4 changed files with 8 additions and 9 deletions

View file

@ -1,14 +1,14 @@
import os import os
SECRET_KEY = os.environ.get("SECRET_KEY") SECRET_KEY = os.environ.get("SECRET_KEY")
KRATOS_URL = os.environ.get("KRATOS_URL")
HYDRA_CLIENT_ID = os.environ.get("HYDRA_CLIENT_ID") HYDRA_CLIENT_ID = os.environ.get("HYDRA_CLIENT_ID")
HYDRA_CLIENT_SECRET = os.environ.get("HYDRA_CLIENT_SECRET") HYDRA_CLIENT_SECRET = os.environ.get("HYDRA_CLIENT_SECRET")
HYDRA_AUTHORIZATION_BASE_URL = os.environ.get("HYDRA_AUTHORIZATION_BASE_URL") HYDRA_AUTHORIZATION_BASE_URL = os.environ.get("HYDRA_AUTHORIZATION_BASE_URL")
HYDRA_URL = os.environ.get("HYDRA_URL")
TOKEN_URL = os.environ.get("TOKEN_URL") TOKEN_URL = os.environ.get("TOKEN_URL")
PUBLIC_URL = os.environ.get('PUBLIC_URL') PUBLIC_URL = os.environ.get('PUBLIC_URL')
HYDRA_PUBLIC_URL = os.environ.get("HYDRA_PUBLIC_URL")
HYDRA_ADMIN_URL = os.environ.get('HYDRA_ADMIN_URL') HYDRA_ADMIN_URL = os.environ.get('HYDRA_ADMIN_URL')
KRATOS_ADMIN_URL = os.environ.get('KRATOS_ADMIN_URL') KRATOS_ADMIN_URL = os.environ.get('KRATOS_ADMIN_URL')
KRATOS_PUBLIC_URL = str(os.environ.get('KRATOS_PUBLIC_URL')) + "/" KRATOS_PUBLIC_URL = str(os.environ.get('KRATOS_PUBLIC_URL')) + "/"

View file

@ -43,7 +43,7 @@ class HydraOauth:
hydra = OAuth2Session( hydra = OAuth2Session(
client_id=HYDRA_CLIENT_ID, token=session["hydra_token"] client_id=HYDRA_CLIENT_ID, token=session["hydra_token"]
) )
user_info = hydra.get("{}/userinfo".format(HYDRA_URL)) user_info = hydra.get("{}/userinfo".format(HYDRA_PUBLIC_URL))
return user_info.json() return user_info.json()
except Exception as err: except Exception as err:

View file

@ -15,7 +15,7 @@ class KratosApi:
@staticmethod @staticmethod
def get(url): def get(url):
try: try:
res = requests.get("{}{}".format(KRATOS_URL, url)) res = requests.get("{}{}".format(KRATOS_ADMIN_URL, url))
KratosApi.__handleError(res) KratosApi.__handleError(res)
return res return res
except KratosError as err: except KratosError as err:
@ -26,7 +26,7 @@ class KratosApi:
@staticmethod @staticmethod
def post(url, data): def post(url, data):
try: try:
res = requests.post("{}{}".format(KRATOS_URL, url), json=data) res = requests.post("{}{}".format(KRATOS_ADMIN_URL, url), json=data)
KratosApi.__handleError(res) KratosApi.__handleError(res)
return res return res
except KratosError as err: except KratosError as err:
@ -37,7 +37,7 @@ class KratosApi:
@staticmethod @staticmethod
def put(url, data): def put(url, data):
try: try:
res = requests.put("{}{}".format(KRATOS_URL, url), json=data) res = requests.put("{}{}".format(KRATOS_ADMIN_URL, url), json=data)
KratosApi.__handleError(res) KratosApi.__handleError(res)
return res return res
except KratosError as err: except KratosError as err:
@ -48,7 +48,7 @@ class KratosApi:
@staticmethod @staticmethod
def delete(url): def delete(url):
try: try:
res = requests.delete("{}{}".format(KRATOS_URL, url)) res = requests.delete("{}{}".format(KRATOS_ADMIN_URL, url))
KratosApi.__handleError(res) KratosApi.__handleError(res)
return res return res
except KratosError as err: except KratosError as err:

View file

@ -21,16 +21,15 @@ fi
export FLASK_APP=app.py export FLASK_APP=app.py
export FLASK_ENV=development export FLASK_ENV=development
export SECRET_KEY="e38hq!@0n64g@qe6)5csk41t=ljo2vllog(%k7njnm4b@kh42c" export SECRET_KEY="e38hq!@0n64g@qe6)5csk41t=ljo2vllog(%k7njnm4b@kh42c"
export KRATOS_URL="http://127.0.0.1:8000"
export HYDRA_CLIENT_ID="dashboard-local" export HYDRA_CLIENT_ID="dashboard-local"
export HYDRA_CLIENT_SECRET="gDSEuakxzybHBHJocnmtDOLMwlWWEvPh" export HYDRA_CLIENT_SECRET="gDSEuakxzybHBHJocnmtDOLMwlWWEvPh"
export HYDRA_URL="https://sso.init.stackspin.net"
export HYDRA_AUTHORIZATION_BASE_URL="https://sso.init.stackspin.net/oauth2/auth" export HYDRA_AUTHORIZATION_BASE_URL="https://sso.init.stackspin.net/oauth2/auth"
export TOKEN_URL="https://sso.init.stackspin.net/oauth2/token" export TOKEN_URL="https://sso.init.stackspin.net/oauth2/token"
# Login facilitator paths # Login facilitator paths
export KRATOS_PUBLIC_URL=http://localhost/kratos export KRATOS_PUBLIC_URL=http://localhost/kratos
export KRATOS_ADMIN_URL=http://localhost:8000 export KRATOS_ADMIN_URL=http://localhost:8000
export HYDRA_PUBLIC_URL="https://sso.init.stackspin.net"
export HYDRA_ADMIN_URL=http://localhost:4445 export HYDRA_ADMIN_URL=http://localhost:4445
export PUBLIC_URL=http://localhost/web/ export PUBLIC_URL=http://localhost/web/
#export DATABASE_URL="mysql+pymysql://stackspin:stackspin@localhost/stackspin?charset=utf8mb4" #export DATABASE_URL="mysql+pymysql://stackspin:stackspin@localhost/stackspin?charset=utf8mb4"