Read oidc users namespace name from env
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
This commit is contained in:
parent
ff8f5eae36
commit
7f321385f7
@ -21,6 +21,8 @@ spec:
|
||||
- name: inventory-app
|
||||
image: inventory-app
|
||||
env:
|
||||
- name: OIDC_USERS_NAMESPACE
|
||||
value: "oidc-gateway"
|
||||
- name: INVENTORY_API_KEY
|
||||
value: "sptWL6XFxl4b8"
|
||||
- name: PYTHONUNBUFFERED
|
||||
|
@ -10,6 +10,7 @@ from kubernetes import client, config
|
||||
page_api = Blueprint("api", __name__)
|
||||
db = MongoClient(const.MONGO_URI).get_default_database()
|
||||
api_key = os.getenv("INVENTORY_API_KEY")
|
||||
OIDC_USERS_NAMESPACE = os.getenv("OIDC_USERS_NAMESPACE")
|
||||
|
||||
def check_api_key(f):
|
||||
@wraps(f)
|
||||
@ -26,7 +27,7 @@ def check_api_key(f):
|
||||
def get_users():
|
||||
config.load_incluster_config()
|
||||
api_instance = client.CustomObjectsApi()
|
||||
ret = api_instance.list_namespaced_custom_object("codemowers.io", "v1alpha1", "default", "oidcgatewayusers")
|
||||
ret = api_instance.list_namespaced_custom_object("codemowers.io", "v1alpha1", OIDC_USERS_NAMESPACE, "oidcgatewayusers")
|
||||
resp = []
|
||||
for item in ret["items"]:
|
||||
resp.append(item)
|
||||
|
Loading…
Reference in New Issue
Block a user