mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:17:35 +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:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user