Delete types/v14.go, replace with v15.go.
Rename internal types to not include message version.
I don't currently see the need to support multiple message
versions that have incompatible layouts.
v15 is backwards compatible with v14, so the config example now
specifies both.
Rename the "response" field in the config file to "static" as
dynamic/static makes more sense from the user's perspective.
(Internally it's still SpaceapidConfig.{Dynamic,Response}
to align with type names and usage.)
38 lines
1.1 KiB
Go
38 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.SpaceAPIResponse `json:"static"`
|
|
}
|