working commit
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -103,32 +102,6 @@ func (conf *Config) ReadConfigfile() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (conf *Config) ReadOptions() error {
|
||||
var err error
|
||||
exename := filepath.Base(os.Args[0])
|
||||
|
||||
// TODO: make local scope of flags
|
||||
|
||||
flagSet := flag.NewFlagSet(exename, flag.ExitOnError)
|
||||
flagSet.Int64Var(&conf.Service.Port, "port", conf.Service.Port, "listen port")
|
||||
flagSet.BoolVar(&conf.AsDaemon, "daemon", conf.AsDaemon, "run as daemon")
|
||||
|
||||
help := func() {
|
||||
fmt.Println("")
|
||||
fmt.Printf("Usage: %s [option]\n", exename)
|
||||
fmt.Println("")
|
||||
fmt.Println("Options:")
|
||||
flagSet.PrintDefaults()
|
||||
fmt.Println("")
|
||||
}
|
||||
flagSet.Usage = help
|
||||
args := flag.Args()
|
||||
if len(args) > 1 {
|
||||
flagSet.Parse(args)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (conf *Config) ReadX509Cert() error {
|
||||
var err error
|
||||
if conf.Certpath != "" && conf.Keypath != "" {
|
||||
|
||||
Reference in New Issue
Block a user