default to ./web when Dir and WebFS are not set

update WebFS doc

Signed-off-by: Rui Yang <ruiya@vmware.com>
Co-authored-by: Aidan Oldershaw <aoldershaw@pivotal.io>
This commit is contained in:
Rui Yang 2021-03-04 10:17:05 -05:00 committed by CI Bot
parent 4e569024fd
commit 2f28fc7451
2 changed files with 6 additions and 2 deletions

View File

@ -111,8 +111,10 @@ type WebConfig struct {
//
Dir string
// A file system includes web static. Will be overwritten by Dir
// It is expected to contain the directories as Dir.
// Alternative way to configure web static filesystem. Dir overrides this.
// It's expected to contain the same files and directories as mentioned
// above in Dir doc.
//
WebFS fs.FS
// Defaults to "( issuer URL )/theme/logo.png"

View File

@ -79,6 +79,8 @@ func loadWebConfig(c webConfig) (http.Handler, http.Handler, *templates, error)
}
if c.dir != "" {
c.webFS = os.DirFS(c.dir)
} else if c.webFS == nil {
c.webFS = os.DirFS("./web")
}
if c.logoURL == "" {
c.logoURL = "theme/logo.png"