feat(handlers): Handle DELETE for environment sensors
It now works as advertised in the README! *ahem*...
This commit is contained in:
parent
abde10bfc9
commit
34d05ffa49
2 changed files with 27 additions and 4 deletions
12
main.go
12
main.go
|
|
@ -68,12 +68,18 @@ func main() {
|
|||
// Register handlers for environmental sensors
|
||||
for sensorType, envSensorConfigs := range conf.Dynamic.Sensors {
|
||||
for i, envSensorConfig := range envSensorConfigs {
|
||||
urlPattern := "PUT " + util.GetSensorURLPath(
|
||||
urlPattern := util.GetSensorURLPath(
|
||||
sensorType, envSensorConfig.SensorData.Location, envSensorConfig.SensorData.Name,
|
||||
)
|
||||
http.HandleFunc(
|
||||
urlPattern,
|
||||
handlers.EnvironmentSensor(
|
||||
"PUT "+urlPattern,
|
||||
handlers.EnvironmentSensorPUT(
|
||||
conf.Credentials, envSensorConfig.AllowedCredentials, &conf.Response.Sensors[sensorType][i],
|
||||
),
|
||||
)
|
||||
http.HandleFunc(
|
||||
"DELETE "+urlPattern,
|
||||
handlers.EnvironmentSensorDELETE(
|
||||
conf.Credentials, envSensorConfig.AllowedCredentials, &conf.Response.Sensors[sensorType][i],
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue