From 2f28fc745120241096b0560add0743a800a6e931 Mon Sep 17 00:00:00 2001 From: Rui Yang Date: Thu, 4 Mar 2021 10:17:05 -0500 Subject: [PATCH] default to ./web when Dir and WebFS are not set update WebFS doc Signed-off-by: Rui Yang Co-authored-by: Aidan Oldershaw --- server/server.go | 6 ++++-- server/templates.go | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/server.go b/server/server.go index 46b23771..17d72af3 100644 --- a/server/server.go +++ b/server/server.go @@ -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" diff --git a/server/templates.go b/server/templates.go index 0d191644..ca5e4d24 100644 --- a/server/templates.go +++ b/server/templates.go @@ -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"