]> Sergey Matveev's repositories - godlighty.git/commitdiff
Configuration spewing
authorSergey Matveev <stargrave@stargrave.org>
Mon, 4 Oct 2021 14:15:49 +0000 (17:15 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 4 Oct 2021 14:15:49 +0000 (17:15 +0300)
cmd/godlighty/main.go
doc/index.texi
go.mod
go.sum

index 6c7114511e455f2134eca5f797ea0716ef73fcd0..4198753b354edb4411c94c105354fec7196bbfac 100644 (file)
@@ -31,6 +31,7 @@ import (
        "syscall"
        "time"
 
+       "github.com/davecgh/go-spew/spew"
        "golang.org/x/net/netutil"
 
        "go.stargrave.org/godlighty"
@@ -91,6 +92,15 @@ func main() {
                }
        }
 
+       info := make(chan os.Signal)
+       signal.Notify(info, syscall.SIGINFO)
+       go func() {
+               for {
+                       <-info
+                       spew.Fdump(os.Stdout, godlighty.Hosts)
+               }
+       }()
+
        srv := http.Server{Handler: godlighty.MainHandler}
        go func() {
                <-shutdown
index 5be423428f06edb29e35a9f06530201bd3142ac3..41a3fd5e2c24ba3c175870369eda492bf5294a9f 100644 (file)
@@ -51,7 +51,13 @@ Can drop (UID, GID, groups) privileges.
 
 @end itemize
 
-Basically all configuration is done directly inside source code.
+Basically all configuration is done directly inside source code. You
+have to recompile it every time configuration changes. Is it a problem?
+I doubt, because Go is very fast. But it produces huge statically linked
+executables, you say! Use @command{bsdiff}/@command{bspatch}!
+
+Send @code{SIGINFO} signal to get current daemon's configuration.
+
 Initially @command{godlighty} has basic static files handlers (with
 compression, HTTP preconditions are enabled of course). In the example
 below there are nearly all default functions.
diff --git a/go.mod b/go.mod
index 0a306c854a0cf99a581bcd0d4fbbf9dc51f9b1cb..5150035327c77b54f368302e859553f0bd084d7d 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -3,6 +3,7 @@ module go.stargrave.org/godlighty
 go 1.17
 
 require (
+       github.com/davecgh/go-spew v1.1.1
        github.com/dustin/go-humanize v1.0.0
        github.com/klauspost/compress v1.13.6
        golang.org/x/net v0.0.0-20210929193557-e81a3d93ecf6
diff --git a/go.sum b/go.sum
index 514e0de3b380bf864d3be2b0d139d556a0094233..03c3f62ae9cf25ea23cc385f05dfeefb61f5d68c 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -1,3 +1,5 @@
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
 github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=