add back the --no-tls-very-insecure for simpler testing

This commit is contained in:
Larry Ruane 2020-02-11 14:17:24 -07:00 committed by Larry Ruane
parent a4f968823f
commit 996de790e2
1 changed files with 19 additions and 13 deletions

View File

@ -83,6 +83,7 @@ type Options struct {
logLevel uint64 `json:"log_level,omitempty"`
logPath string `json:"log_file,omitempty"`
zcashConfPath string `json:"zcash_conf,omitempty"`
veryInsecure bool `json:"very_insecure,omitempty"`
cacheSize int `json:"cache_size,omitempty"`
wantVersion bool
}
@ -103,6 +104,7 @@ func main() {
flag.Uint64Var(&opts.logLevel, "log-level", uint64(logrus.InfoLevel), "log level (logrus 1-7)")
flag.StringVar(&opts.logPath, "log-file", "./server.log", "log file to write to")
flag.StringVar(&opts.zcashConfPath, "conf-file", "./zcash.conf", "conf file to pull RPC creds from")
flag.BoolVar(&opts.veryInsecure, "no-tls-very-insecure", false, "run without the required TLS certificate, only for debugging, DO NOT use in production")
flag.BoolVar(&opts.wantVersion, "version", false, "version (major.minor.patch)")
flag.IntVar(&opts.cacheSize, "cache-size", 80000, "number of blocks to hold in the cache")
@ -154,9 +156,12 @@ func main() {
// gRPC initialization
var server *grpc.Server
var transportCreds credentials.TransportCredentials
var err error
if opts.veryInsecure {
server = grpc.NewServer(LoggingInterceptor())
} else {
var transportCreds credentials.TransportCredentials
if (opts.tlsCertPath == "") && (opts.tlsKeyPath == "") {
common.Log.Warning("Certificate and key not provided, generating self signed values")
tlsCert := common.GenerateCerts()
@ -172,6 +177,7 @@ func main() {
}
}
server = grpc.NewServer(grpc.Creds(transportCreds), LoggingInterceptor())
}
// Enable reflection for debugging
if opts.logLevel >= uint64(logrus.WarnLevel) {