Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #27 from fourcube/add-print-publickey-flag
Browse files Browse the repository at this point in the history
Add `-k` flag for printing the signature public key
  • Loading branch information
fourcube authored Oct 11, 2018
2 parents afc09e3 + 42be0e7 commit b5cc5f3
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions goiban_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ import (
"github.com/rs/cors"
)

const (
// SigningKey can be used to validate that the goiban-service binary
// has been signed by the original author
SigningKey = `-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEZGBXuKuau9Q+cnDCHsN48ovzopce+QcU
qab1BAkJZXNdDHxEoQFnf72TYuzl3LjTsLuIA2tpx55sG79zgJHG6hyso7aUuQ+c
vQrNHMoC/IHD9FkIqWrBH1xZe8LE9X9t
-----END PUBLIC KEY-----`
)

/**
Handles requests and serves static pages.
Expand All @@ -47,14 +57,15 @@ var (
// Set at link time
Version string = "dev"
// Flags
dataPath string
staticPath string
mysqlURL string
pidFile string
port string
help bool
web bool
printVersion bool
dataPath string
staticPath string
mysqlURL string
pidFile string
port string
help bool
web bool
printVersion bool
printSigningKey bool
)

func init() {
Expand All @@ -66,6 +77,7 @@ func init() {
flag.StringVar(&port, "port", "8080", "HTTP Port or interface to listen on")
flag.BoolVar(&help, "h", false, "Show usage")
flag.BoolVar(&printVersion, "v", false, "Show version")
flag.BoolVar(&printSigningKey, "k", false, "Show public key for signature validation")
flag.BoolVar(&web, "w", false, "Serve staticPath folder")
}

Expand All @@ -82,6 +94,11 @@ func main() {
return
}

if printSigningKey {
fmt.Println(SigningKey)
return
}

if pidFile != "" {
CreatePidfile(pidFile)
}
Expand Down

0 comments on commit b5cc5f3

Please sign in to comment.