diff --git a/html/fileserver.go b/html/fileserver.go
index 245b8d1c..bd6d86bb 100644
--- a/html/fileserver.go
+++ b/html/fileserver.go
@@ -8,16 +8,15 @@ import (
"os"
"path/filepath"
"strings"
- "time"
"github.com/Gleipnir-Technology/nidus-sync/config"
"github.com/go-chi/chi/v5"
"github.com/rs/zerolog/log"
)
-// FileServer conveniently sets up a http.FileServer handler to serve
+// fileServer conveniently sets up a http.FileServer handler to serve
// static files from a http.FileSystem.
-func FileServer(r chi.Router, path string, root http.FileSystem, embeddedFS embed.FS, embeddedPath string) {
+func fileServer(r chi.Router, path string, root http.FileSystem, embeddedFS embed.FS, embeddedPath string) {
if strings.ContainsAny(path, "{}*") {
panic("FileServer does not permit any URL parameters.")
}
@@ -68,7 +67,7 @@ func FileServer(r chi.Router, path string, root http.FileSystem, embeddedFS embe
crw := &customResponseWriter{ResponseWriter: w}
// Serve the file
- http.ServeContent(crw, r, requestedPath, time.Time{}, fileToServe)
+ http.ServeContent(crw, r, requestedPath, startedTime, fileToServe)
// Close the file
fileToServe.Close()
diff --git a/html/html.go b/html/html.go
index 209fc7ae..0ff59d64 100644
--- a/html/html.go
+++ b/html/html.go
@@ -2,8 +2,15 @@ package html
import (
"net/http"
+ "time"
)
func RenderOrError(w http.ResponseWriter, template_name string, content interface{}) {
templates.renderOrError(w, template_name, content)
}
+
+var startedTime time.Time
+
+func SetStartedTime() {
+ startedTime = time.Now()
+}
diff --git a/html/static.go b/html/static.go
index 4f4818a0..ca2a707e 100644
--- a/html/static.go
+++ b/html/static.go
@@ -16,5 +16,5 @@ func AddStaticRoute(r chi.Router, path string) {
if localFS == "" {
localFS = http.Dir("./html/static")
}
- FileServer(r, "/static", localFS, EmbeddedStaticFS, "static")
+ fileServer(r, "/static", localFS, EmbeddedStaticFS, "static")
}
diff --git a/main.go b/main.go
index bdf7f294..5ea76a2a 100644
--- a/main.go
+++ b/main.go
@@ -143,6 +143,7 @@ func main() {
log.Error().Err(err).Msg("Failed to start openAI client")
os.Exit(8)
}
+ http.SetStartedTime()
server := &http.Server{
Addr: config.Bind,
Handler: r,