mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-07 23:17: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_OAUTH=http://localhost:50022
|
||||||
export ZITADEL_CONSOLE=http://localhost:4200
|
export ZITADEL_CONSOLE=http://localhost:4200
|
||||||
export CAOS_OIDC_DEV=true
|
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:
|
Console:
|
||||||
Port: 50050
|
Port: 50050
|
||||||
|
EnvOverwritePath: $ZITADEL_CONSOLE_ENV_PATH
|
||||||
|
|
||||||
|
|
||||||
Notification:
|
Notification:
|
||||||
|
@ -72,7 +72,7 @@ spec:
|
|||||||
- name: zitadel-secret
|
- name: zitadel-secret
|
||||||
mountPath: /secret
|
mountPath: /secret
|
||||||
- name: console-config
|
- name: console-config
|
||||||
mountPath: /app/console/dist/assets/environment.json
|
mountPath: /assets/environment.json
|
||||||
subPath: environment.json
|
subPath: environment.json
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: githubsecret
|
- name: githubsecret
|
||||||
|
@ -12,13 +12,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Port string
|
Port string
|
||||||
|
EnvOverwritePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
type spaHandler struct {
|
type spaHandler struct {
|
||||||
fileSystem http.FileSystem
|
fileSystem http.FileSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
envRequestPath = "/assets/environment.json"
|
||||||
|
)
|
||||||
|
|
||||||
func (i *spaHandler) Open(name string) (http.File, error) {
|
func (i *spaHandler) Open(name string) (http.File, error) {
|
||||||
ret, err := i.fileSystem.Open(name)
|
ret, err := i.fileSystem.Open(name)
|
||||||
if !os.IsNotExist(err) || path.Ext(name) != "" {
|
if !os.IsNotExist(err) || path.Ext(name) != "" {
|
||||||
@ -33,6 +38,11 @@ func Start(ctx context.Context, config Config) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
envPath := envRequestPath
|
||||||
|
if config.EnvOverwritePath != "" {
|
||||||
|
envPath = config.EnvOverwritePath
|
||||||
|
}
|
||||||
http.Handle("/", http.FileServer(&spaHandler{statikFS}))
|
http.Handle("/", http.FileServer(&spaHandler{statikFS}))
|
||||||
|
http.Handle(envRequestPath, http.FileServer(http.Dir(envPath)))
|
||||||
return http.ListenAndServe(":"+config.Port, nil)
|
return http.ListenAndServe(":"+config.Port, nil)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user