forked from gsn/predictor
28 lines
1,009 B
Go
28 lines
1,009 B
Go
package service
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
type Config struct {
|
|
// --- GRIB Configuration ---
|
|
GribDir string `env:"GSN_PREDICTOR_GRIB_DIR" envDefault:"/tmp/grib"`
|
|
GribTTL time.Duration `env:"GSN_PREDICTOR_GRIB_TTL" envDefault:"24h"`
|
|
GribCacheTTL time.Duration `env:"GSN_PREDICTOR_GRIB_CACHE_TTL" envDefault:"1h"`
|
|
GribParallel int `env:"GSN_PREDICTOR_GRIB_PARALLEL" envDefault:"4"`
|
|
GribTimeout time.Duration `env:"GSN_PREDICTOR_GRIB_TIMEOUT" envDefault:"30s"`
|
|
GribDatasetURL string `env:"GSN_PREDICTOR_GRIB_DATASET_URL" envDefault:"https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod"`
|
|
|
|
// --- Redis Configuration ---
|
|
RedisHost string `env:"GSN_PREDICTOR_REDIS_HOST"`
|
|
RedisPort int `env:"GSN_PREDICTOR_REDIS_PORT"`
|
|
RedisPassword string `env:"GSN_PREDICTOR_REDIS_PASSWORD"`
|
|
RedisDB int `env:"GSN_PREDICTOR_REDIS_DB"`
|
|
}
|
|
|
|
func (c *Config) CreateHTTPClient() *http.Client {
|
|
return &http.Client{
|
|
Timeout: c.GribTimeout,
|
|
}
|
|
}
|