Skip to content

Commit

Permalink
Fix CORS setting reading from json
Browse files Browse the repository at this point in the history
Display current configuration values with `-v` option
  • Loading branch information
tectiv3 committed May 17, 2019
1 parent c169177 commit eea575c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log"
"os"
"runtime"
"strconv"
"syscall"

"github.com/sevlyar/go-daemon"
Expand All @@ -24,7 +25,7 @@ type Config struct {
NoReg bool `config:"noreg"`
Debug bool `config:"debug"`
Foreground bool `config:"foreground"`
UseCORS bool `config:"cors"`
UseCORS bool `config:"cors" json:"cors" yaml:"cors" toml:"cors"`
}

var cfg = Config{
Expand Down Expand Up @@ -70,11 +71,17 @@ func main() {
flag.Parse()

if *ver {
fmt.Println(` Version: ` + Version + `
Built: ` + BuildTime + `
Go version: ` + runtime.Version() + `
OS/Arch: ` + runtime.GOOS + "/" + runtime.GOARCH)

fmt.Println(` Version: ` + Version + `
Built: ` + BuildTime + `
Go Version: ` + runtime.Version() + `
OS/Arch: ` + runtime.GOOS + "/" + runtime.GOARCH + `
No Registrations: ` + strconv.FormatBool(cfg.NoReg) + `
CORS Enabled: ` + strconv.FormatBool(cfg.UseCORS) + `
Run in Foreground: ` + strconv.FormatBool(cfg.Foreground) + `
Webserver Port: ` + strconv.Itoa(cfg.Port) + `
CORS Enabled: ` + strconv.FormatBool(cfg.UseCORS) + `
DB Path: ` + cfg.DB + `
Debug: ` + strconv.FormatBool(cfg.Debug))
return
}

Expand Down

0 comments on commit eea575c

Please sign in to comment.