spaceapid/config/types.go
2024-05-26 20:52:15 +02:00

39 lines
1.1 KiB
Go

package config
import (
"git.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 map[string][]EnvironmentSensorConfig `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:"response"`
}