Skip to content

Commit

Permalink
Add the possibility to toggle introspection on and off, toggle it off…
Browse files Browse the repository at this point in the history
… for internal
  • Loading branch information
bilalebi committed Sep 25, 2024
1 parent b011cf1 commit 36ab2b2
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 8 deletions.
5 changes: 4 additions & 1 deletion graphql_service/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@

load_dotenv("connections.conf")

DEBUG_MODE = os.getenv("DEBUG_MODE", False) == "True"
DEBUG_MODE = os.getenv("DEBUG_MODE", "false").lower() == "true"
ENABLE_INTROSPECTION = os.getenv("ENABLE_INTROSPECTION", "true").lower() == "true"

EXTENSIONS: Optional[ExtensionList] = (
None # mypy will throw an incompatible type error without this type cast
)
Expand Down Expand Up @@ -172,5 +174,6 @@ def __init__(
extensions=EXTENSIONS,
),
explorer=CustomExplorerGraphiQL(),
introspection=ENABLE_INTROSPECTION,
),
)
10 changes: 6 additions & 4 deletions k8s/web-prod/base/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
apiVersion: v1
data:
DEBUG_MODE: "False"
HTTP_PROXY: <HTTP_PROXY>
HTTPS_PROXY: <HTTP_PROXY>
http_proxy: <HTTP_PROXY>
https_proxy: <HTTP_PROXY>
ENABLE_INTROSPECTION: "True"
HTTP_PROXY: "http://pg-wwwcache.ebi.ac.uk:3128"
HTTPS_PROXY: "http://pg-wwwcache.ebi.ac.uk:3128"
http_proxy: "http://pg-wwwcache.ebi.ac.uk:3128"
https_proxy: "http://pg-wwwcache.ebi.ac.uk:3128"
no_proxy: ".ebi.ac.uk,localhost,127.0.0.1,.cluster.local"
kind: ConfigMap
metadata:
name: proxy-configmap
3 changes: 2 additions & 1 deletion k8s/web-prod/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- deployment.yaml
- configmap.yaml
7 changes: 7 additions & 0 deletions k8s/web-prod/overlays/apps/configmap-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: proxy-configmap # This matches the name in the base configmap.yaml
data:
# The new values we want to override
DEBUG_MODE: "True"
5 changes: 5 additions & 0 deletions k8s/web-prod/overlays/apps/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ patches:
kind: Deployment
name: graphql-core-deployment
path: patch.yaml
- target:
version: v1
kind: ConfigMap
name: proxy-configmap # This must match the name in our base
path: configmap-patch.yaml # Add our new patch for the ConfigMap
7 changes: 7 additions & 0 deletions k8s/web-prod/overlays/internal/configmap-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: proxy-configmap # This matches the name in the base configmap.yaml
data:
# The new values we want to override
ENABLE_INTROSPECTION: "False"
6 changes: 4 additions & 2 deletions k8s/web-prod/overlays/internal/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base

patchesStrategicMerge:
- configmap-patch.yaml
# Uncomment when migrating to new-k8s
# patchesStrategicMerge:
# - patch.yaml
# - patch.yaml

0 comments on commit 36ab2b2

Please sign in to comment.