working as intended
This commit is contained in:
23
main.go
23
main.go
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user