diff --git a/config/config.go b/config/config.go index 8092560..20c0419 100644 --- a/config/config.go +++ b/config/config.go @@ -7,6 +7,8 @@ import ( "os" "path/filepath" "slices" + + "gitlab.hamburg.ccc.de/ccchh/spaceapid/types" ) const ( @@ -50,5 +52,14 @@ func ParseConfiguration() (conf SpaceapidConfig) { log.Fatalln("Provided file doesn't specify compatibility with API version 14") } + // Initialise fields for environment sensors + conf.Response.Sensors = make(map[string][]types.EnvironmentSensor) + for key, sensorConfigs := range conf.Dynamic.Sensors { + conf.Response.Sensors[key] = make([]types.EnvironmentSensor, len(sensorConfigs)) + for i, sensorConfig := range sensorConfigs { + conf.Response.Sensors[key][i] = sensorConfig.SensorData + } + } + return }