support json schema
All checks were successful
Build and Publish / release (push) Has been skipped
Build and Publish / check-chart (push) Successful in 10s
Build and Publish / helm-release (push) Has been skipped

This commit is contained in:
2025-03-22 14:04:20 -04:00
parent b483fc22a3
commit 46a213f314
9 changed files with 366 additions and 85 deletions

View File

@@ -6,25 +6,25 @@ import (
// This configuration includes all config from go-app/config.AppConfig
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"` // No env, too complex, not worth the time
RecorderConfig *RecorderConfig `yaml:"recorderConfig"`
MetricPrefix string `yaml:"metricPrefix" default:"weather" env:"AMBIENT_METRIC_PREFIX" json:"metricPrefix,omitempty"`
UpdatesToKeep *int `yaml:"updatesToKeep" default:"1" env:"AMBIENT_UPDATES_TO_KEEP" json:"updatesToKeep,omitempty"`
WeatherStations []WeatherStation `yaml:"weatherStations" json:"weatherStations,omitempty"` // No env, too complex, not worth the time
RecorderConfig *RecorderConfig `yaml:"recorderConfig" json:"recorderConfig,omitempty"`
*config.AppConfig // Extends app config
}
type WeatherStation struct {
Name string `yaml:"name"` // Human Friendly Name (e.g. Back Yard Weather)
Equipment string `yaml:"equipment"` // Equipment Type (e.g. WS-5000)
Name string `yaml:"name" json:"name,omitempty"` // Human Friendly Name (e.g. Back Yard Weather)
Equipment string `yaml:"equipment" json:"equipment,omitempty"` // Equipment Type (e.g. WS-5000)
// Required if proxying to awn/wu is enabled
WundergroundID string `yaml:"wundergroundID"`
WundergroundPassword string `yaml:"wundergroundPassword"`
AWNPassKey string `yaml:"awnPassKey"`
WundergroundID string `yaml:"wundergroundID" json:"wundergroundID,omitempty"`
WundergroundPassword string `yaml:"wundergroundPassword" json:"wundergroundPassword,omitempty"`
AWNPassKey string `yaml:"awnPassKey" json:"awnPassKey,omitempty"`
// Proxy updates to AWN or Wunderground
ProxyToAWN bool `yaml:"proxyToAWN"`
ProxyToWunderground bool `yaml:"proxyToWunderground"`
ProxyToAWN bool `yaml:"proxyToAWN" json:"proxyToAWN,omitempty"`
ProxyToWunderground bool `yaml:"proxyToWunderground" json:"proxyToWunderground,omitempty"`
// Unreliable / unwanted metrics by name of WeatherUpdate Field
// will be excluded if present in discardMetrics
@@ -33,8 +33,8 @@ type WeatherStation struct {
// ignoring discardMetrics.
//
// Check weather.WeatherUpdateField for options
KeepMetrics []string `yaml:"keepMetrics"`
DropMetrics []string `yaml:"dropMetrics"`
KeepMetrics []string `yaml:"keepMetrics" json:"keepMetrics,omitempty"`
DropMetrics []string `yaml:"dropMetrics" json:"dropMetrics,omitempty"`
// Relabels battery and sensor names
// Temp+Humidity Sensors:
@@ -44,5 +44,5 @@ type WeatherStation struct {
// - OutdoorSensor
// - RainSensor
// - CO2Sensor
SensorMappings map[string]string `yaml:"sensorMappings"`
SensorMappings map[string]string `yaml:"sensorMappings" json:"sensorMappings,omitempty"`
}