Skip to content

Commit

Permalink
fix: raise error if waved cannot find public/private dir h2oai#2130
Browse files Browse the repository at this point in the history
  • Loading branch information
Ammar Raza committed Dec 6, 2023
1 parent 454c7dc commit b9e5a07
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,21 @@ func Run(conf ServerConf) {
fileDir := filepath.Join(conf.DataDir, "f")
handle("_f/", newFileServer(fileDir, conf.Keychain, auth, conf.BaseURL+"_f"))
for _, dir := range conf.PrivateDirs {

prefix, src := splitDirMapping(dir)
err := newDirServer(src, conf.Keychain, auth)
if err != nil {
log.Fatalf("Failed to start server due to directory issue: %v", err)
}
echo(Log{"t": "private_dir", "source": src, "address": prefix})
handle(prefix, http.StripPrefix(conf.BaseURL+prefix, newDirServer(src, conf.Keychain, auth)))
}
for _, dir := range conf.PublicDirs {
prefix, src := splitDirMapping(dir)
err := newDirServer(src, conf.Keychain, auth)
if err != nil {
log.Fatalf("Failed to start server due to directory issue: %v", err)
}
echo(Log{"t": "public_dir", "source": src, "address": prefix})
handle(prefix, http.StripPrefix(conf.BaseURL+prefix, http.FileServer(http.Dir(src))))
}
Expand Down

0 comments on commit b9e5a07

Please sign in to comment.