mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 13:57:33 +00:00
fix: console env directory (#189)
* fix: serve console env from os (not statik) * ZITADEL_CONSOLE_ENV_PATH for (local) overwrite possibility * name EnvOverwritePath * fix: console env directory * fix mount path * fix default dir
This commit is contained in:
@@ -48,4 +48,4 @@ export CAOS_OIDC_DEV=true
|
||||
export ZITADEL_COOKIE_DOMAIN=localhost
|
||||
|
||||
#Console
|
||||
export ZITADEL_CONSOLE_ENV_PATH=../../console/src/
|
||||
export ZITADEL_CONSOLE_ENV_DIR=../../console/src/assets/
|
@@ -191,7 +191,7 @@ Admin:
|
||||
|
||||
Console:
|
||||
Port: 50050
|
||||
EnvOverwritePath: $ZITADEL_CONSOLE_ENV_PATH
|
||||
EnvOverwriteDir: $ZITADEL_CONSOLE_ENV_DIR
|
||||
|
||||
|
||||
Notification:
|
||||
|
@@ -72,7 +72,7 @@ spec:
|
||||
- name: zitadel-secret
|
||||
mountPath: /secret
|
||||
- name: console-config
|
||||
mountPath: /assets/environment.json
|
||||
mountPath: /console/environment.json
|
||||
subPath: environment.json
|
||||
imagePullSecrets:
|
||||
- name: githubsecret
|
||||
|
@@ -12,8 +12,8 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Port string
|
||||
EnvOverwritePath string
|
||||
Port string
|
||||
EnvOverwriteDir string
|
||||
}
|
||||
|
||||
type spaHandler struct {
|
||||
@@ -22,6 +22,7 @@ type spaHandler struct {
|
||||
|
||||
const (
|
||||
envRequestPath = "/assets/environment.json"
|
||||
envDefaultDir = "/console/"
|
||||
)
|
||||
|
||||
func (i *spaHandler) Open(name string) (http.File, error) {
|
||||
@@ -38,11 +39,11 @@ func Start(ctx context.Context, config Config) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
envPath := envRequestPath
|
||||
if config.EnvOverwritePath != "" {
|
||||
envPath = config.EnvOverwritePath
|
||||
envDir := envDefaultDir
|
||||
if config.EnvOverwriteDir != "" {
|
||||
envDir = config.EnvOverwriteDir
|
||||
}
|
||||
http.Handle("/", http.FileServer(&spaHandler{statikFS}))
|
||||
http.Handle(envRequestPath, http.FileServer(http.Dir(envPath)))
|
||||
http.Handle(envRequestPath, http.StripPrefix("/assets", http.FileServer(http.Dir(envDir))))
|
||||
return http.ListenAndServe(":"+config.Port, nil)
|
||||
}
|
||||
|
Reference in New Issue
Block a user