Switch to admin role first thing in camper-weather

The authenticator user has no access to the weather_forecast relation.
This commit is contained in:
jordi fita mas 2025-01-29 11:19:08 +01:00
parent 5ccd796e1b
commit 9b938dad97
1 changed files with 4 additions and 4 deletions

View File

@ -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