From 9f579304f1a790a3c83eeeddea73fa52143afa9b Mon Sep 17 00:00:00 2001 From: "Sahdev P. Zala" Date: Sun, 13 Sep 2020 23:10:39 -0400 Subject: [PATCH] config: grpc gateway Currently, the grpc gateway is enabled by default when run the etcd server using command line configuration. However, when provide config through config file, the grpc gateway is disabled by default. We should either use the same approach or at least document this. related #https://github.com/etcd-io/etcd/issues/12093 --- embed/config.go | 4 +++- etcdmain/config.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/embed/config.go b/embed/config.go index 05f58231110a..5fd0691e72dc 100644 --- a/embed/config.go +++ b/embed/config.go @@ -323,7 +323,8 @@ type Config struct { loggerCore zapcore.Core loggerWriteSyncer zapcore.WriteSyncer - // EnableGRPCGateway is false to disable grpc gateway. + // EnableGRPCGateway enables grpc gateway. + // The gateway translates a RESTful HTTP API into gRPC. EnableGRPCGateway bool `json:"enable-grpc-gateway"` // UnsafeNoFsync disables all uses of fsync. @@ -411,6 +412,7 @@ func NewConfig() *Config { Logger: "zap", LogOutputs: []string{DefaultLogOutput}, LogLevel: logutil.DefaultLogLevel, + EnableGRPCGateway: true, } cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name) return cfg diff --git a/etcdmain/config.go b/etcdmain/config.go index 7d0c7d7b2c83..d576d70b91c3 100644 --- a/etcdmain/config.go +++ b/etcdmain/config.go @@ -243,7 +243,7 @@ func newConfig() *config { fs.UintVar(&cfg.ec.AuthTokenTTL, "auth-token-ttl", cfg.ec.AuthTokenTTL, "The lifetime in seconds of the auth token.") // gateway - fs.BoolVar(&cfg.ec.EnableGRPCGateway, "enable-grpc-gateway", true, "Enable GRPC gateway.") + fs.BoolVar(&cfg.ec.EnableGRPCGateway, "enable-grpc-gateway", cfg.ec.EnableGRPCGateway, "Enable GRPC gateway.") // experimental fs.BoolVar(&cfg.ec.ExperimentalInitialCorruptCheck, "experimental-initial-corrupt-check", cfg.ec.ExperimentalInitialCorruptCheck, "Enable to check data corruption before serving any client/peer traffic.")