# HG changeset patch # User Sascha L. Teichmann # Date 1567157411 -7200 # Node ID 2de64420870615c79b5c087f24892352d21f2811 # Parent acb83c50dfc472b319977821c34035b896677626 GeoServer config: Moved ReconfigureStyle function out of boot.go into reconf.go . diff -r acb83c50dfc4 -r 2de644208706 pkg/geoserver/boot.go --- a/pkg/geoserver/boot.go Fri Aug 30 10:09:59 2019 +0200 +++ b/pkg/geoserver/boot.go Fri Aug 30 11:30:11 2019 +0200 @@ -619,30 +619,3 @@ return nil } - -// ReconfigureStyle returns a function to update a style -// in the GeoServer to be in sync with the database. -func ReconfigureStyle(name string) { - Reconfigure(func() error { - var stls styles - if err := stls.load(); err != nil { - return err - } - - entries := models.InternalServices.Filter( - models.IntAnd( - models.IntWMS, - models.IntWithStyle, - models.IntByName(name))) - - for i := range entries { - entry := &entries[i] - create := !stls.hasStyle(entry.Name) - if err := updateStyle(entry, create); err != nil { - return err - } - } - - return nil - }) -} diff -r acb83c50dfc4 -r 2de644208706 pkg/geoserver/reconf.go --- a/pkg/geoserver/reconf.go Fri Aug 30 10:09:59 2019 +0200 +++ b/pkg/geoserver/reconf.go Fri Aug 30 11:30:11 2019 +0200 @@ -20,6 +20,8 @@ "net/url" "sync" "time" + + "gemma.intevation.de/gemma/pkg/models" ) var ( @@ -82,3 +84,30 @@ confQueue.PushBack(fn) confQueueCond.Signal() } + +// ReconfigureStyle returns a function to update a style +// in the GeoServer to be in sync with the database. +func ReconfigureStyle(name string) { + Reconfigure(func() error { + var stls styles + if err := stls.load(); err != nil { + return err + } + + entries := models.InternalServices.Filter( + models.IntAnd( + models.IntWMS, + models.IntWithStyle, + models.IntByName(name))) + + for i := range entries { + entry := &entries[i] + create := !stls.hasStyle(entry.Name) + if err := updateStyle(entry, create); err != nil { + return err + } + } + + return nil + }) +}