support json schema
This commit is contained in:
		| @@ -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"` | ||||
| } | ||||
|   | ||||
| @@ -9,17 +9,17 @@ const ( | ||||
| ) | ||||
|  | ||||
| type RecorderConfig struct { | ||||
| 	Type        RecorderType `yaml:"type" env:"RECORDER_TYPE"` // memory|redis | ||||
| 	KeepLast    int          `yaml:"keepLast" env:"RECORDER_KEEP_LAST"` | ||||
| 	RedisConfig *RedisConfig | ||||
| 	Type        RecorderType `yaml:"type" env:"RECORDER_TYPE" json:"type,omitempty"` // memory|redis | ||||
| 	KeepLast    int          `yaml:"keepLast" env:"RECORDER_KEEP_LAST" json:"keepLast,omitempty"` | ||||
| 	RedisConfig *RedisConfig `json:"redisConfig,omitempty"` | ||||
| } | ||||
|  | ||||
| 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"` | ||||
| 	RedisHost        string `yaml:"redisHost" env:"REDIS_HOST" default:"127.0.0.1" json:"redisHost,omitempty"` | ||||
| 	RedisPort        int    `yaml:"redisPort" env:"REDIS_PORT" default:"6379" json:"redisPort,omitempty"` | ||||
| 	RedisUser        string `yaml:"redisUser" env:"REDIS_USER" json:"redisUser,omitempty"` | ||||
| 	RedisPassword    string `yaml:"redisPassword" env:"REDIS_PASSWORD" json:"redisPassword,omitempty"` | ||||
| 	RedisDB          int    `yaml:"redisDB" env:"REDIS_DB" default:"0" json:"redisDB,omitempty"` | ||||
| 	RedisTLS         bool   `yaml:"redisTLS" env:"REDIS_TLS" default:"false" json:"redisTLS,omitempty"` | ||||
| 	RedisTLSInsecure bool   `yaml:"redisTLSInsecure" env:"REDIS_TLS_INSECURE" default:"false" json:"redisTLSInsecure,omitempty"` | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user