Skip to content

Commit

Permalink
Use StaticDir if provided
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Jan 28, 2025
1 parent d66f90f commit f08c379
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,14 @@ func Router(routes []Route, fsys fs.FS, static string, webServer srvConfig.WebSe
panic(err)
}
m := fmt.Sprintf("%s/%s", base, dir)
r.StaticFS(m, http.FS(filesFS))
if webServer.StaticDir != "" {
sdir := filepath.Join(webServer.StaticDir, dir)
log.Printf("for end-point %s use static directory %s\n", m, sdir)
r.StaticFS(m, http.Dir(sdir))
} else {
log.Printf("for end-point %s use embeded fs\n", m)
r.StaticFS(m, http.FS(filesFS))
}
}
}
}
Expand Down

0 comments on commit f08c379

Please sign in to comment.