Skip to content

Commit

Permalink
other: Optimize command line parameter name
Browse files Browse the repository at this point in the history
ssl-devs -> ssl-cacert

Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Feb 19, 2021
1 parent 33731fa commit d12669a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Config struct {
WebPort int
SslCert string
SslKey string
SslDevices string
SslCacert string // mTLS for device
HTTPUsername string
HTTPPassword string
Token string
Expand Down Expand Up @@ -50,7 +50,7 @@ func Parse(c *cli.Context) *Config {
WebRedirURL: c.String("web-redir-url"),
SslCert: c.String("ssl-cert"),
SslKey: c.String("ssl-key"),
SslDevices: c.String("ssl-devs"),
SslCacert: c.String("ssl-cacert"),
HTTPUsername: c.String("http-username"),
HTTPPassword: c.String("http-password"),
Token: c.String("token"),
Expand All @@ -76,7 +76,7 @@ func Parse(c *cli.Context) *Config {
getConfigOpt(yamlCfg, "web-redir-url", &cfg.WebRedirURL)
getConfigOpt(yamlCfg, "ssl-cert", &cfg.SslCert)
getConfigOpt(yamlCfg, "ssl-key", &cfg.SslKey)
getConfigOpt(yamlCfg, "ssl-devs", &cfg.SslDevices)
getConfigOpt(yamlCfg, "ssl-cacert", &cfg.SslCacert)
getConfigOpt(yamlCfg, "http-username", &cfg.HTTPUsername)
getConfigOpt(yamlCfg, "http-password", &cfg.HTTPPassword)
getConfigOpt(yamlCfg, "token", &cfg.Token)
Expand Down
4 changes: 2 additions & 2 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ func listenDevice(br *broker) {
tlsConfig.Time = time.Now
tlsConfig.Rand = rand.Reader

if cfg.SslDevices == "" {
if cfg.SslCacert == "" {
log.Warn().Msgf("mTLS not enabled")
} else {
caCert, err := ioutil.ReadFile(cfg.SslDevices)
caCert, err := ioutil.ReadFile(cfg.SslCacert)
if err != nil {
log.Error().Msgf("mTLS not enabled: %s", err.Error())
} else {
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"os/signal"
"syscall"
"runtime"
"io/ioutil"
"syscall"

"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -58,7 +58,7 @@ func runRttys(c *cli.Context) {
case syscall.SIGUSR1:
if br.devCertPool != nil {
log.Info().Msg("Reload certs for mTLS")
caCert, err := ioutil.ReadFile(cfg.SslDevices)
caCert, err := ioutil.ReadFile(cfg.SslCacert)
if err != nil {
log.Info().Msgf("mTLS update faled: %s", err.Error())
} else {
Expand Down Expand Up @@ -131,7 +131,7 @@ func main() {
Usage: "ssl key file Path",
},
&cli.StringFlag{
Name: "ssl-devs",
Name: "ssl-cacert",
Value: "",
Usage: "mtls CA storage in PEM file Path",
},
Expand Down

0 comments on commit d12669a

Please sign in to comment.