working as intended

This commit is contained in:
Maximilian Wagner
2025-12-26 02:50:34 +01:00
parent 6fc4ee2716
commit 8dcf9fba11
5 changed files with 110 additions and 15 deletions

23
main.go
View File

@@ -1,14 +1,16 @@
package main
import (
"os"
"os/signal"
"syscall"
"io/fs"
"context"
"fmt"
"time"
"io/fs"
"net/http"
"os"
"os/signal"
"path/filepath"
"syscall"
"time"
"git.noctra.dev/noctra/servtex/backend"
"git.noctra.dev/noctra/servtex/frontend"
"git.noctra.dev/noctra/servtex/globals"
@@ -49,6 +51,15 @@ func main() {
if globals.AppConfig.WebserverSecure {
go serverSecure.ListenAndServeTLS(globals.AppConfig.CertificatePath, globals.AppConfig.CertificateKeyPath)
}
// file system change watch
absTexPath, err := filepath.Abs(globals.AppConfig.LatexSourceFilePath)
if err == nil {
backend.ChangeWatch(filepath.Dir(absTexPath), backend.LatexCompile)
} else {
backend.LogLine("Absolute TeX file path could not be gotten", 4)
}
backend.LogLine("Started", 2)
fmt.Println("Press CTRL-C to Exit ServTeX")
@@ -61,7 +72,7 @@ func main() {
fmt.Print("\r")
// shutdown
context, cancel := context.WithTimeout(context.Background(), 15*time.Second)
context, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
if err = server.Shutdown(context); err != nil {
backend.LogLine("Graceful Shutdown failed", 4)