add back the --no-tls-very-insecure for simpler testing
This commit is contained in:
parent
a4f968823f
commit
996de790e2
|
@ -83,6 +83,7 @@ type Options struct {
|
||||||
logLevel uint64 `json:"log_level,omitempty"`
|
logLevel uint64 `json:"log_level,omitempty"`
|
||||||
logPath string `json:"log_file,omitempty"`
|
logPath string `json:"log_file,omitempty"`
|
||||||
zcashConfPath string `json:"zcash_conf,omitempty"`
|
zcashConfPath string `json:"zcash_conf,omitempty"`
|
||||||
|
veryInsecure bool `json:"very_insecure,omitempty"`
|
||||||
cacheSize int `json:"cache_size,omitempty"`
|
cacheSize int `json:"cache_size,omitempty"`
|
||||||
wantVersion bool
|
wantVersion bool
|
||||||
}
|
}
|
||||||
|
@ -103,6 +104,7 @@ func main() {
|
||||||
flag.Uint64Var(&opts.logLevel, "log-level", uint64(logrus.InfoLevel), "log level (logrus 1-7)")
|
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.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.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.BoolVar(&opts.wantVersion, "version", false, "version (major.minor.patch)")
|
||||||
flag.IntVar(&opts.cacheSize, "cache-size", 80000, "number of blocks to hold in the cache")
|
flag.IntVar(&opts.cacheSize, "cache-size", 80000, "number of blocks to hold in the cache")
|
||||||
|
|
||||||
|
@ -154,24 +156,28 @@ func main() {
|
||||||
|
|
||||||
// gRPC initialization
|
// gRPC initialization
|
||||||
var server *grpc.Server
|
var server *grpc.Server
|
||||||
var transportCreds credentials.TransportCredentials
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if (opts.tlsCertPath == "") && (opts.tlsKeyPath == "") {
|
if opts.veryInsecure {
|
||||||
common.Log.Warning("Certificate and key not provided, generating self signed values")
|
server = grpc.NewServer(LoggingInterceptor())
|
||||||
tlsCert := common.GenerateCerts()
|
|
||||||
transportCreds = credentials.NewServerTLSFromCert(tlsCert)
|
|
||||||
} else {
|
} else {
|
||||||
transportCreds, err = credentials.NewServerTLSFromFile(opts.tlsCertPath, opts.tlsKeyPath)
|
var transportCreds credentials.TransportCredentials
|
||||||
if err != nil {
|
if (opts.tlsCertPath == "") && (opts.tlsKeyPath == "") {
|
||||||
common.Log.WithFields(logrus.Fields{
|
common.Log.Warning("Certificate and key not provided, generating self signed values")
|
||||||
"cert_file": opts.tlsCertPath,
|
tlsCert := common.GenerateCerts()
|
||||||
"key_path": opts.tlsKeyPath,
|
transportCreds = credentials.NewServerTLSFromCert(tlsCert)
|
||||||
"error": err,
|
} else {
|
||||||
}).Fatal("couldn't load TLS credentials")
|
transportCreds, err = credentials.NewServerTLSFromFile(opts.tlsCertPath, opts.tlsKeyPath)
|
||||||
|
if err != nil {
|
||||||
|
common.Log.WithFields(logrus.Fields{
|
||||||
|
"cert_file": opts.tlsCertPath,
|
||||||
|
"key_path": opts.tlsKeyPath,
|
||||||
|
"error": err,
|
||||||
|
}).Fatal("couldn't load TLS credentials")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
server = grpc.NewServer(grpc.Creds(transportCreds), LoggingInterceptor())
|
||||||
}
|
}
|
||||||
server = grpc.NewServer(grpc.Creds(transportCreds), LoggingInterceptor())
|
|
||||||
|
|
||||||
// Enable reflection for debugging
|
// Enable reflection for debugging
|
||||||
if opts.logLevel >= uint64(logrus.WarnLevel) {
|
if opts.logLevel >= uint64(logrus.WarnLevel) {
|
||||||
|
|
Loading…
Reference in New Issue