Skip to content

Commit

Permalink
Fix: Env Vars used in UI app (#128)
Browse files Browse the repository at this point in the history
fix: env vars used in UI app
  • Loading branch information
mrsauravsahu committed May 12, 2024
1 parent ee006ed commit a1a401c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
10 changes: 9 additions & 1 deletion apps/ui/k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ image:
repository: ghcr.io/payobills/apps/ui
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.2.0-alpha.8"
tag: "0.2.2"

imagePullSecrets: []
nameOverride: ""
Expand All @@ -32,6 +32,14 @@ pod:
value: "80"
- name: BILLS_SERVICE
value: "http://bills.payobills-dev.svc.cluster.local"
- name: OIDC_CLIENT_ID
value: "payobills"
- name: OIDC_TENANT_URL
value: "http://idp.mrsauravsahu.in"
- name: OWN_URL
value: "http://payobills.mrsauravsahu.in"
- name: OIDC_TENANT_LOGIN_URL_TEMPLATE
value: "${OIDC_TENANT_URL}/auth/realms/homelab/protocol/openid-connect/auth?client_id=${OIDC_CLIENT_ID}&redirect_uri=${OWN_URL}/callback&response_type=code&grant_type=authorization_code&scope=openid"

podAnnotations: {}

Expand Down
11 changes: 6 additions & 5 deletions apps/ui/src/src/routes/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { OIDC_TENANT_LOGIN_URL_TEMPLATE, OIDC_TENANT_URL, OWN_URL } from '$env/static/private';
import { env } from '$env/dynamic/private';

/** @type {import('./$types').PageLoad} */
export function load() {

var loginUrl = OIDC_TENANT_LOGIN_URL_TEMPLATE
.replace('${OWN_URL}', OWN_URL)
.replace('${OIDC_TENANT_URL}', OIDC_TENANT_URL)
var loginUrl = env.OIDC_TENANT_LOGIN_URL_TEMPLATE
.replace('${OWN_URL}', env.OWN_URL)
.replace('${OIDC_CLIENT_ID}', env.OIDC_CLIENT_ID)
.replace('${OIDC_TENANT_URL}', env.OIDC_TENANT_URL)

return {
urls: {
oidcUrl: OIDC_TENANT_URL,
oidcUrl: env.OIDC_TENANT_URL,
loginUrl
}
};
Expand Down
6 changes: 3 additions & 3 deletions apps/ui/src/src/routes/callback/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { OIDC_TENANT_URL, OWN_URL } from '$env/static/private';
import { env } from '$env/dynamic/private';

/** @type {import('./$types').PageLoad} */
export function load() {
return {
urls: {
oidcUrl: OIDC_TENANT_URL,
ownUrl: OWN_URL
oidcUrl: env.OIDC_TENANT_URL,
ownUrl: env.OWN_URL
}
};
}

0 comments on commit a1a401c

Please sign in to comment.