From 05f8912d9d8fe6ebdfe3d6c7c8cebf6941c53b11 Mon Sep 17 00:00:00 2001
From: msantos <msantos@wikimedia.org>
Date: Wed, 6 Nov 2024 21:33:55 +0100
Subject: [PATCH] Debug: force the ory config for testing purposes

---
 .github/workflows/aws.yml            | 3 ++-
 Dockerfile                           | 1 +
 deployment/k8s/modules/container.pkl | 3 +--
 src/lib/orysdk/index.ts              | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml
index e505ff7af..54788205c 100644
--- a/.github/workflows/aws.yml
+++ b/.github/workflows/aws.yml
@@ -33,7 +33,7 @@ jobs:
             MONGODB_NAME: ${{ secrets.MONGODB_NAME }}
             ORY_SDK_URL: ${{ secrets.ORY_SDK_URL }}
             ORY_ACCESS_TOKEN: ${{ secrets.ORY_ACCESS_TOKEN }}
-            ORYCLOUD: true
+            ORYCLOUD: "enabled"
             ALETHEIA_SCHEMA_ID: ${{ secrets.ALETHEIA_SCHEMA_ID }}
             RECAPTCHA_SITEKEY: ${{ secrets.RECAPTCHA_SITEKEY }}
             NOVU_API_KEY: ${{ secrets.NOVU_API_KEY }}
@@ -112,6 +112,7 @@ jobs:
             ORY_ACCESS_TOKEN: ${{ secrets.ORY_ACCESS_TOKEN }}
             RECAPTCHA_SITEKEY: ${{ secrets.RECAPTCHA_SITEKEY }}
             OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+            ORYCLOUD: "enabled"
             TAG: ${{ github.sha}}
         steps:
             - name: Checkout
diff --git a/Dockerfile b/Dockerfile
index 8bc965737..d87fcbafb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,6 +4,7 @@ ARG NEXT_PUBLIC_UMAMI_SITE_ID
 ARG NEXT_PUBLIC_RECAPTCHA_SITEKEY
 ARG NEXT_PUBLIC_ENVIRONMENT
 ARG NEXT_PUBLIC_ORY_SDK_URL
+ARG NEXT_PUBLIC_ORYCLOUD
 ARG ENVIRONMENT
 ENV PARCEL_WORKERS=1
 ENV NEW_RELIC_NO_CONFIG_FILE=true
diff --git a/deployment/k8s/modules/container.pkl b/deployment/k8s/modules/container.pkl
index 0d9634d0b..89bf14b07 100644
--- a/deployment/k8s/modules/container.pkl
+++ b/deployment/k8s/modules/container.pkl
@@ -5,7 +5,6 @@ import "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1#/api/core/v1/PodSpec.pkl"
 hidden namespace = ""
 hidden imagePath = ""
 hidden podPort = ""
-hidden oryCloud = "true"
 
 container: PodSpec.Container = new {
     name = ""
@@ -50,7 +49,7 @@ container: PodSpec.Container = new {
         }
         new {
             name = "NEXT_PUBLIC_ORYCLOUD"
-            value = oryCloud
+            value = read("env:ORYCLOUD")
         }
     }
 
diff --git a/src/lib/orysdk/index.ts b/src/lib/orysdk/index.ts
index 080c8329c..6011c93a4 100644
--- a/src/lib/orysdk/index.ts
+++ b/src/lib/orysdk/index.ts
@@ -3,7 +3,7 @@ import { edgeConfig } from "@ory/integrations/next";
 
 let oryConfig = new Configuration(edgeConfig);
 
-if (process.env.NEXT_PUBLIC_ORYCLOUD === "true") {
+if (process.env.NEXT_PUBLIC_ORYCLOUD === "enabled") {
     oryConfig = new Configuration({
         basePath: process.env.NEXT_PUBLIC_ORY_SDK_URL,
         baseOptions: {