diff --git a/cmd/zitadel/caos_local.sh b/cmd/zitadel/caos_local.sh index 7b4451192b..e5e0754874 100755 --- a/cmd/zitadel/caos_local.sh +++ b/cmd/zitadel/caos_local.sh @@ -45,4 +45,7 @@ export ZITADEL_AUTHORIZE=http://localhost:50022 export ZITADEL_OAUTH=http://localhost:50022 export ZITADEL_CONSOLE=http://localhost:4200 export CAOS_OIDC_DEV=true -export ZITADEL_COOKIE_DOMAIN=localhost \ No newline at end of file +export ZITADEL_COOKIE_DOMAIN=localhost + +#Console +export ZITADEL_CONSOLE_ENV_PATH=../../console/src/ \ No newline at end of file diff --git a/cmd/zitadel/startup.yaml b/cmd/zitadel/startup.yaml index 318628acad..6f45d5726b 100644 --- a/cmd/zitadel/startup.yaml +++ b/cmd/zitadel/startup.yaml @@ -191,6 +191,7 @@ Admin: Console: Port: 50050 + EnvOverwritePath: $ZITADEL_CONSOLE_ENV_PATH Notification: diff --git a/k8s/base/deployment.yaml b/k8s/base/deployment.yaml index 5f2c373eff..61cdf98c79 100644 --- a/k8s/base/deployment.yaml +++ b/k8s/base/deployment.yaml @@ -72,7 +72,7 @@ spec: - name: zitadel-secret mountPath: /secret - name: console-config - mountPath: /app/console/dist/assets/environment.json + mountPath: /assets/environment.json subPath: environment.json imagePullSecrets: - name: githubsecret diff --git a/pkg/console/console.go b/pkg/console/console.go index d68ededd75..7876878482 100644 --- a/pkg/console/console.go +++ b/pkg/console/console.go @@ -12,13 +12,18 @@ import ( ) type Config struct { - Port string + Port string + EnvOverwritePath string } type spaHandler struct { fileSystem http.FileSystem } +const ( + envRequestPath = "/assets/environment.json" +) + func (i *spaHandler) Open(name string) (http.File, error) { ret, err := i.fileSystem.Open(name) if !os.IsNotExist(err) || path.Ext(name) != "" { @@ -33,6 +38,11 @@ func Start(ctx context.Context, config Config) error { if err != nil { return err } + envPath := envRequestPath + if config.EnvOverwritePath != "" { + envPath = config.EnvOverwritePath + } http.Handle("/", http.FileServer(&spaHandler{statikFS})) + http.Handle(envRequestPath, http.FileServer(http.Dir(envPath))) return http.ListenAndServe(":"+config.Port, nil) }