2024-01-13 23:16:10 +01:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2024-01-31 17:11:15 +01:00
|
|
|
"git.hamburg.ccc.de/ccchh/spaceapid/types"
|
2024-01-13 23:16:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
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 {
|
2024-01-14 01:01:12 +01:00
|
|
|
Sensors map[string][]EnvironmentSensorConfig `json:"sensors"`
|
|
|
|
State struct {
|
2024-01-13 23:16:10 +01:00
|
|
|
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
|
2024-01-14 00:59:57 +01:00
|
|
|
Response types.SpaceAPIResponseV14 `json:"response"`
|
2024-01-13 23:16:10 +01:00
|
|
|
}
|