feat: polish & windviz & deploy
This commit is contained in:
parent
81b8e763bd
commit
465ad00f7b
78 changed files with 20622 additions and 2154 deletions
|
|
@ -22,6 +22,7 @@ type Config struct {
|
|||
Data DataConfig `yaml:"data"`
|
||||
Download DownloadConfig `yaml:"download"`
|
||||
Metrics MetricsConfig `yaml:"metrics"`
|
||||
Wind WindConfig `yaml:"wind"`
|
||||
Log LogConfig `yaml:"log"`
|
||||
}
|
||||
|
||||
|
|
@ -40,16 +41,17 @@ type HTTPConfig struct {
|
|||
type DataConfig struct {
|
||||
Dir string `yaml:"dir"`
|
||||
ElevationPath string `yaml:"elevation_path"`
|
||||
// Source is the dataset source identifier; only "noaa-gfs-0p50" is supported today.
|
||||
// Source is the dataset variant ID: gfs-0p50-3h (default), gfs-0p25-3h,
|
||||
// gfs-0p25-1h, or gefs-0p50-3h. See weather/gfs.VariantByID.
|
||||
Source string `yaml:"source"`
|
||||
}
|
||||
|
||||
// DownloadConfig configures the dataset downloader.
|
||||
type DownloadConfig struct {
|
||||
Parallel int `yaml:"parallel"`
|
||||
BandwidthBytesPerSecond int64 `yaml:"bandwidth_bytes_per_second"`
|
||||
UpdateInterval time.Duration `yaml:"update_interval"`
|
||||
FreshnessTTL time.Duration `yaml:"freshness_ttl"`
|
||||
Parallel int `yaml:"parallel"`
|
||||
BandwidthBytesPerSecond int64 `yaml:"bandwidth_bytes_per_second"`
|
||||
UpdateInterval time.Duration `yaml:"update_interval"`
|
||||
FreshnessTTL time.Duration `yaml:"freshness_ttl"`
|
||||
}
|
||||
|
||||
// MetricsConfig configures the metrics endpoint.
|
||||
|
|
@ -58,6 +60,13 @@ type MetricsConfig struct {
|
|||
Path string `yaml:"path"`
|
||||
}
|
||||
|
||||
// WindConfig configures the wind-visualization endpoints.
|
||||
type WindConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
CacheSize int `yaml:"cache_size"`
|
||||
CacheTTL time.Duration `yaml:"cache_ttl"`
|
||||
}
|
||||
|
||||
// LogConfig configures logging.
|
||||
type LogConfig struct {
|
||||
Level string `yaml:"level"` // "debug", "info", "warn", "error"
|
||||
|
|
@ -87,6 +96,11 @@ func Defaults() Config {
|
|||
Enabled: true,
|
||||
Path: "/metrics",
|
||||
},
|
||||
Wind: WindConfig{
|
||||
Enabled: true,
|
||||
CacheSize: 64,
|
||||
CacheTTL: 10 * time.Minute,
|
||||
},
|
||||
Log: LogConfig{Level: "info"},
|
||||
}
|
||||
}
|
||||
|
|
@ -106,16 +120,16 @@ func Load(args []string) (Config, error) {
|
|||
var (
|
||||
configPath = fs.String("config", os.Getenv("PREDICTOR_CONFIG_FILE"), "path to YAML config file")
|
||||
// Flag-driven overrides. Empty / -1 means "not specified".
|
||||
flagPort = fs.Int("port", -1, "HTTP listen port")
|
||||
flagDataDir = fs.String("data-dir", "", "directory for dataset files")
|
||||
flagElevation = fs.String("elevation", "", "path to ruaumoko elevation dataset")
|
||||
flagParallel = fs.Int("download-parallel", -1, "max concurrent GRIB downloads")
|
||||
flagBandwidth = fs.Int64("download-bandwidth", -1, "download bandwidth limit in bytes/sec (0 = unlimited)")
|
||||
flagInterval = fs.Duration("update-interval", 0, "scheduler refresh interval")
|
||||
flagTTL = fs.Duration("freshness-ttl", 0, "max age before a dataset is considered stale")
|
||||
flagPort = fs.Int("port", -1, "HTTP listen port")
|
||||
flagDataDir = fs.String("data-dir", "", "directory for dataset files")
|
||||
flagElevation = fs.String("elevation", "", "path to ruaumoko elevation dataset")
|
||||
flagParallel = fs.Int("download-parallel", -1, "max concurrent GRIB downloads")
|
||||
flagBandwidth = fs.Int64("download-bandwidth", -1, "download bandwidth limit in bytes/sec (0 = unlimited)")
|
||||
flagInterval = fs.Duration("update-interval", 0, "scheduler refresh interval")
|
||||
flagTTL = fs.Duration("freshness-ttl", 0, "max age before a dataset is considered stale")
|
||||
flagMetricsEnabled = fs.Bool("metrics", true, "enable Prometheus-compatible metrics endpoint")
|
||||
flagMetricsPath = fs.String("metrics-path", "", "HTTP path for the metrics endpoint")
|
||||
flagLogLevel = fs.String("log-level", "", "log level: debug|info|warn|error")
|
||||
flagMetricsPath = fs.String("metrics-path", "", "HTTP path for the metrics endpoint")
|
||||
flagLogLevel = fs.String("log-level", "", "log level: debug|info|warn|error")
|
||||
)
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return Config{}, fmt.Errorf("parse flags: %w", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue