recorder implementations
All checks were successful
Build and Publish / release (push) Has been skipped
Build and Publish / check-chart (push) Successful in 11s
Build and Publish / helm-release (push) Has been skipped

This commit is contained in:
2025-03-22 12:05:25 -04:00
parent fb6941e6bd
commit b483fc22a3
16 changed files with 498 additions and 71 deletions

View File

@ -8,7 +8,8 @@ import (
type AmbientLocalExporterConfig struct {
MetricPrefix string `yaml:"metricPrefix" default:"weather" env:"AMBIENT_METRIC_PREFIX"`
UpdatesToKeep *int `yaml:"updatesToKeep" default:"1" env:"AMBIENT_UPDATES_TO_KEEP"`
WeatherStations []WeatherStation `yaml:"weatherStations" env:"weatherStations"` // No env, too complex, not worth the time
WeatherStations []WeatherStation `yaml:"weatherStations"` // No env, too complex, not worth the time
RecorderConfig *RecorderConfig `yaml:"recorderConfig"`
*config.AppConfig // Extends app config
}

View File

@ -0,0 +1,25 @@
package config
type RecorderType string
const (
TypeMemory RecorderType = "memory" // Stores weather updates in memory
TypeRedis RecorderType = "redis" // Required for replicas > 1
TypeNoop RecorderType = "noop" // No-op implementation
)
type RecorderConfig struct {
Type RecorderType `yaml:"type" env:"RECORDER_TYPE"` // memory|redis
KeepLast int `yaml:"keepLast" env:"RECORDER_KEEP_LAST"`
RedisConfig *RedisConfig
}
type RedisConfig struct {
RedisHost string `yaml:"redisHost" env:"REDIS_HOST" default:"127.0.0.1"`
RedisPort int `yaml:"redisPort" env:"REDIS_PORT" default:"6379"`
RedisUser string `yaml:"redisUser" env:"REDIS_USER"`
RedisPassword string `yaml:"redisPassword" env:"REDIS_PASSWORD"`
RedisDB int `yaml:"redisDB" env:"REDIS_DB" default:"0"`
RedisTLS bool `yaml:"redisTLS" env:"REDIS_TLS" default:"false"`
RedisTLSInsecure bool `yaml:"redisTLSInsecure" env:"REDIS_TLS_INSECURE" default:"false"`
}