mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-06 13:57:41 +00:00
fix: serve console env from os (not statik) (#187)
* fix: serve console env from os (not statik) * ZITADEL_CONSOLE_ENV_PATH for (local) overwrite possibility * name EnvOverwritePath
This commit is contained in:
parent
c0f18832e7
commit
0da6dc1d66
@ -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
|
||||
export ZITADEL_COOKIE_DOMAIN=localhost
|
||||
|
||||
#Console
|
||||
export ZITADEL_CONSOLE_ENV_PATH=../../console/src/
|
@ -191,6 +191,7 @@ Admin:
|
||||
|
||||
Console:
|
||||
Port: 50050
|
||||
EnvOverwritePath: $ZITADEL_CONSOLE_ENV_PATH
|
||||
|
||||
|
||||
Notification:
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user