spaceapid/config/types.go

42 lines
1.2 KiB
Go
Raw Normal View History

package config
import (
"gitlab.hamburg.ccc.de/ccchh/spaceapid/types"
)
type HTTPBACredentialID string
type HTTPBACredentials map[HTTPBACredentialID]HTTPBACredential
type HTTPBACredential struct {
Username string `json:"username"`
Password string `json:"password"`
}
type EnvironmentSensorConfig struct {
SensorData types.EnvironmentSensor `json:"sensor_data"`
AllowedCredentials []HTTPBACredentialID `json:"allowed_credentials"`
}
type DynamicStateConfig struct {
Sensors struct {
Temperature []EnvironmentSensorConfig `json:"temperature"`
Humidity []EnvironmentSensorConfig `json:"humidity"`
} `json:"sensors"`
State struct {
Open struct {
AllowedCredentials []HTTPBACredentialID `json:"allowed_credentials"`
} `json:"open"`
} `json:"state"`
}
// SpaceapidConfig is the representation of the config.json file
type SpaceapidConfig struct {
// A list of username/password pairs for BasicAuth endpoints
Credentials HTTPBACredentials `json:"credentials"`
// The dynamic part of the spaceapi JSON
Dynamic DynamicStateConfig `json:"dynamic"`
// The static part of the spaceapi JSON
Response types.SpaceAPIResponseV14 `json:"static"`
}