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:
Livio Amstutz
2020-06-09 08:44:55 +02:00
committed by GitHub
parent 0da6dc1d66
commit 5e931a3c13
4 changed files with 10 additions and 9 deletions

View File

@@ -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/

View File

@@ -191,7 +191,7 @@ Admin:
Console:
Port: 50050
EnvOverwritePath: $ZITADEL_CONSOLE_ENV_PATH
EnvOverwriteDir: $ZITADEL_CONSOLE_ENV_DIR
Notification:

View File

@@ -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

View File

@@ -13,7 +13,7 @@ import (
type Config struct {
Port string
EnvOverwritePath 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)
}