diff --git a/gateway/main.go b/gateway/main.go index a8ebf9daef26a275ad79afdb8d56d5848d025354..dfc7c446eddf1b6c42d4552b594bb9f787bbb8e3 100644 --- a/gateway/main.go +++ b/gateway/main.go @@ -27,10 +27,6 @@ const NameExpression = "-a-zA-Z_0-9." func main() { - if len(version.GitCommitMessage) == 0 { - version.GitCommitMessage = "See GitHub for latest changes" - } - osEnv := types.OsEnv{} readConfig := types.ReadConfig{} config, configErr := readConfig.Read(osEnv) @@ -38,15 +34,18 @@ func main() { if configErr != nil { log.Fatalln(configErr) } - - log.Printf("HTTP Read Timeout: %s", config.ReadTimeout) - log.Printf("HTTP Write Timeout: %s", config.WriteTimeout) - if !config.UseExternalProvider() { log.Fatalln("You must provide an external provider via 'functions_provider_url' env-var.") } - log.Printf("Binding to external function provider: %s", config.FunctionsProviderURL) + fmt.Printf("OpenFaaS Gateway - Community Edition (CE)\n"+ + "\nVersion: %s Commit: %s\nTimeouts: read=%s\twrite=%s\tupstream=%s\nFunction provider: %s\n\n", + version.BuildVersion(), + version.GitCommitSHA, + config.ReadTimeout, + config.WriteTimeout, + config.UpstreamTimeout, + config.FunctionsProviderURL) // credentials is used for service-to-service auth var credentials *auth.BasicAuthCredentials @@ -67,9 +66,6 @@ func main() { servicePollInterval := time.Second * 5 - metadataQuery := metrics.NewMetadataQuery(credentials) - fmt.Println(metadataQuery) - metricsOptions := metrics.BuildMetricsOptions() exporter := metrics.NewExporter(metricsOptions, credentials, config.Namespace) exporter.StartServiceWatcher(*config.FunctionsProviderURL, metricsOptions, "func", servicePollInterval) diff --git a/gateway/types/readconfig.go b/gateway/types/readconfig.go index b0b2ff9fa0fb556f6c373ec9c210ede81c51fde8..aea315218260191f4e7198ece8f7681d4360e1f8 100644 --- a/gateway/types/readconfig.go +++ b/gateway/types/readconfig.go @@ -59,7 +59,7 @@ func (ReadConfig) Read(hasEnv HasEnv) (*GatewayConfig, error) { PrometheusPort: 9090, } - defaultDuration := time.Second * 8 + defaultDuration := time.Second * 60 cfg.ReadTimeout = parseIntOrDurationValue(hasEnv.Getenv("read_timeout"), defaultDuration) cfg.WriteTimeout = parseIntOrDurationValue(hasEnv.Getenv("write_timeout"), defaultDuration) diff --git a/gateway/types/readconfig_test.go b/gateway/types/readconfig_test.go index e81a0276987319603b1501df07ea9b23b8a6d281..acada92d5486ab2dc1755702171883e79bb92e2d 100644 --- a/gateway/types/readconfig_test.go +++ b/gateway/types/readconfig_test.go @@ -198,13 +198,16 @@ func TestRead_EmptyTimeoutConfig(t *testing.T) { config, _ := readConfig.Read(defaults) - if (config.ReadTimeout) != time.Duration(8)*time.Second { - t.Log("ReadTimeout incorrect") - t.Fail() + want := time.Second * 60 + got := config.ReadTimeout + if got != want { + t.Fatalf("config.ReadTimeout want: %s, but got: %s", want, got) } - if (config.WriteTimeout) != time.Duration(8)*time.Second { - t.Log("WriteTimeout incorrect") - t.Fail() + + want = time.Second * 60 + got = config.WriteTimeout + if got != want { + t.Fatalf("config.WriteTimeout want: %s, but got: %s", want, got) } } diff --git a/gateway/version/version.go b/gateway/version/version.go index e1011c276662245c6645fb328d15a92a6990b1ac..70e5fcd1eca974ba782ffa43c0559318e554d07f 100644 --- a/gateway/version/version.go +++ b/gateway/version/version.go @@ -8,7 +8,7 @@ var ( GitCommitSHA string // GitCommitMessage as read from the latest tag/release - GitCommitMessage string + GitCommitMessage = "See GitHub for latest changes" // DevVersion string for the development version DevVersion = "dev"