aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-05 20:30:00 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-05 20:30:00 +0800
commit2ade4a186e12960aef9d2e9f5d06439c85bb481e (patch)
treedf80d579860a0a7340680821373300b63d5d1146 /main.go
parentdatabase shall no longer be a global variable (diff)
downloadforge-2ade4a186e12960aef9d2e9f5d06439c85bb481e.tar.gz
forge-2ade4a186e12960aef9d2e9f5d06439c85bb481e.tar.zst
forge-2ade4a186e12960aef9d2e9f5d06439c85bb481e.zip
source/static-Handler shall no longer be global variables
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/main.go b/main.go
index 4527825..8eca6a7 100644
--- a/main.go
+++ b/main.go
@@ -6,6 +6,7 @@ package main
import (
"errors"
"flag"
+ "io/fs"
"log"
"log/slog"
"net"
@@ -26,6 +27,16 @@ func main() {
s := server{}
+ s.sourceHandler = http.StripPrefix(
+ "/-/source/",
+ http.FileServer(http.FS(embeddedSourceFS)),
+ )
+ staticFS, err := fs.Sub(embeddedResourcesFS, "static")
+ if err != nil {
+ panic(err)
+ }
+ s.staticHandler = http.StripPrefix("/-/static/", http.FileServer(http.FS(staticFS)))
+
if err := s.loadConfig(*configPath); err != nil {
slog.Error("loading configuration", "error", err)
os.Exit(1)