forked from gsn/predictor
feat: s3 download
This commit is contained in:
parent
a850615e1f
commit
c4f355a32e
15 changed files with 590 additions and 109 deletions
|
|
@ -1,22 +0,0 @@
|
|||
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"`
|
||||
}
|
||||
|
||||
func (c *Config) CreateHTTPClient() *http.Client {
|
||||
return &http.Client{
|
||||
Timeout: c.GribTimeout,
|
||||
}
|
||||
}
|
||||
|
|
@ -8,13 +8,11 @@ import (
|
|||
)
|
||||
|
||||
type Service struct {
|
||||
cfg *Config
|
||||
grib Grib
|
||||
}
|
||||
|
||||
func New(cfg *Config, gribService Grib) (*Service, error) {
|
||||
func New(gribService Grib) (*Service, error) {
|
||||
svc := &Service{
|
||||
cfg: cfg,
|
||||
grib: gribService,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue