Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit eea575c

Browse files
committed
Fix CORS setting reading from json
Display current configuration values with `-v` option
1 parent c169177 commit eea575c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

main.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"log"
88
"os"
99
"runtime"
10+
"strconv"
1011
"syscall"
1112

1213
"github.com/sevlyar/go-daemon"
@@ -24,7 +25,7 @@ type Config struct {
2425
NoReg bool `config:"noreg"`
2526
Debug bool `config:"debug"`
2627
Foreground bool `config:"foreground"`
27-
UseCORS bool `config:"cors"`
28+
UseCORS bool `config:"cors" json:"cors" yaml:"cors" toml:"cors"`
2829
}
2930

3031
var cfg = Config{
@@ -70,11 +71,17 @@ func main() {
7071
flag.Parse()
7172

7273
if *ver {
73-
fmt.Println(` Version: ` + Version + `
74-
Built: ` + BuildTime + `
75-
Go version: ` + runtime.Version() + `
76-
OS/Arch: ` + runtime.GOOS + "/" + runtime.GOARCH)
77-
74+
fmt.Println(` Version: ` + Version + `
75+
Built: ` + BuildTime + `
76+
Go Version: ` + runtime.Version() + `
77+
OS/Arch: ` + runtime.GOOS + "/" + runtime.GOARCH + `
78+
No Registrations: ` + strconv.FormatBool(cfg.NoReg) + `
79+
CORS Enabled: ` + strconv.FormatBool(cfg.UseCORS) + `
80+
Run in Foreground: ` + strconv.FormatBool(cfg.Foreground) + `
81+
Webserver Port: ` + strconv.Itoa(cfg.Port) + `
82+
CORS Enabled: ` + strconv.FormatBool(cfg.UseCORS) + `
83+
DB Path: ` + cfg.DB + `
84+
Debug: ` + strconv.FormatBool(cfg.Debug))
7885
return
7986
}
8087

0 commit comments

Comments
 (0)