mirror of
https://github.com/openfaas/faas.git
synced 2025-06-08 08:25:03 +00:00
Introduce welcome message and change default timeout
The welcome message shows the difference between Pro and CE. The timeout of 8 seconds was never going to be useful as a default, so changing to 60 seconds. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
This commit is contained in:
parent
9fccc67b9c
commit
4604271076
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user