From 9b938dad97d32334f44d85d39efd306caa1c365d Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Wed, 29 Jan 2025 11:19:08 +0100 Subject: [PATCH] Switch to admin role first thing in camper-weather The authenticator user has no access to the weather_forecast relation. --- cmd/camper-weather/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/camper-weather/main.go b/cmd/camper-weather/main.go index 42a9e49..824fcab 100644 --- a/cmd/camper-weather/main.go +++ b/cmd/camper-weather/main.go @@ -43,6 +43,10 @@ func main() { } defer conn.Release() + if _, err := conn.Exec(context.Background(), "set role to admin"); err != nil { + log.Fatal(err) + } + var stationURL string if err := conn.QueryRow(context.Background(), ` select station_uri @@ -63,10 +67,6 @@ func main() { log.Fatal(err) } - if _, err := conn.Exec(context.Background(), "set role to admin"); err != nil { - log.Fatal(err) - } - for _, forecast := range result.Forecasts { if _, err := db.Exec(context.Background(), ` update weather_forecast