feat(platform-api): enforce request timeout
This commit is contained in:
@@ -3,6 +3,7 @@ package config
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -18,6 +19,7 @@ type Config struct {
|
||||
TDengineDatabase string
|
||||
CapacityCheckBin string
|
||||
AuthToken string
|
||||
RequestTimeout time.Duration
|
||||
}
|
||||
|
||||
func Load() Config {
|
||||
@@ -34,6 +36,7 @@ func Load() Config {
|
||||
TDengineDatabase: env("TDENGINE_DATABASE", "lingniu_vehicle_ts"),
|
||||
CapacityCheckBin: os.Getenv("CAPACITY_CHECK_BIN"),
|
||||
AuthToken: os.Getenv("AUTH_TOKEN"),
|
||||
RequestTimeout: time.Duration(envInt("REQUEST_TIMEOUT_MS", 5000)) * time.Millisecond,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user