recorder implementations
This commit is contained in:
		| @@ -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 | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										25
									
								
								pkg/ambient/config/config_recorder.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								pkg/ambient/config/config_recorder.go
									
									
									
									
									
										Normal 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"` | ||||
| } | ||||
		Reference in New Issue
	
	Block a user