Mercurial > gemma
changeset 4290:2de644208706
GeoServer config: Moved ReconfigureStyle function out of boot.go into reconf.go .
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 30 Aug 2019 11:30:11 +0200 |
parents | acb83c50dfc4 |
children | 81ab34bd2d0d |
files | pkg/geoserver/boot.go pkg/geoserver/reconf.go |
diffstat | 2 files changed, 29 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- 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 - }) -}
--- 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 + }) +}