Configurable listen port

This commit is contained in:
kamkow1
2025-06-21 14:55:24 +02:00
parent 05c0eaebaa
commit 59bb805ecd
2 changed files with 15 additions and 2 deletions

5
lts.go
View File

@ -17,6 +17,8 @@ import (
"github.com/fsnotify/fsnotify"
)
var LISTEN_PORT string
//go:embed tmpls/*
var tmpls embed.FS
@ -114,6 +116,7 @@ func handleUpload(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Uploaded file: %s\n", handler.Filename)
fmt.Fprintf(w, "File size: %s\n", byteCountSI(handler.Size))
fmt.Fprintf(w, "Link: ")
dst, err := createFile(storePath, handler.Filename)
if err != nil {
@ -242,7 +245,7 @@ func main() {
http.Handle("/etc/", http.FileServerFS(etc))
http.Handle("/store/", http.StripPrefix("/store/", http.FileServer(http.Dir(storePath))))
http.ListenAndServe(":9090", nil)
http.ListenAndServe(LISTEN_PORT, nil)
doneWatching<-true
}