Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/controller/mapfilegenerator/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func MapWFSToMapfileGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoperatorv
Abstract: mapperutils.EscapeQuotes(wfs.Spec.Service.Abstract),
Keywords: strings.Join(wfs.Spec.Service.KeywordsIncludingInspireKeyword(), ","),
OnlineResource: pdoknlv3.GetHost(true),
Path: mapperutils.GetPath(wfs),
Path: "/" + pdoknlv3.GetBaseURLPath(wfs),
MetadataID: metadataID,
Extent: extent,
NamespacePrefix: wfs.Spec.Service.Prefix,
Expand Down Expand Up @@ -198,7 +198,7 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, _ *smoothoperatorv1.OwnerI
NamespacePrefix: datasetName,
NamespaceURI: fmt.Sprintf("%s://%s.geonovum.nl", protocol, datasetName),
OnlineResource: pdoknlv3.GetHost(true),
Path: mapperutils.GetPath(wms),
Path: "/" + pdoknlv3.GetBaseURLPath(wms),
MetadataID: metadataID,
DatasetOwner: &datasetOwner,
AuthorityURL: &authorityURL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ spec:
ownerInfoRef: ""
prefix: prefix
title: some Service title
url: ""
url: "http://localhost:32788/datasetOwner/dataset/theme/wfs/v1_0"
20 changes: 0 additions & 20 deletions internal/controller/mapperutils/utils.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package mapperutils

import (
"fmt"
"strings"

pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
Expand Down Expand Up @@ -54,25 +53,6 @@ func EscapeQuotes(s string) string {
return strings.ReplaceAll(s, "\"", "\\\"")
}

func GetPath[O pdoknlv3.WMSWFS](obj O) (path string) {
webserviceType := strings.ToLower(string(obj.Type()))
datasetOwner := GetLabelValueByKey(obj.GetLabels(), "dataset-owner")
dataset := GetLabelValueByKey(obj.GetLabels(), "dataset")
theme := GetLabelValueByKey(obj.GetLabels(), "theme")
serviceVersion := GetLabelValueByKey(obj.GetLabels(), "service-version")

path = fmt.Sprintf("/%s/%s", *datasetOwner, *dataset)
if theme != nil {
path += "/" + *theme
}
path += "/" + webserviceType
if serviceVersion != nil {
path += "/" + *serviceVersion
}

return path
}

func GetLabelValueByKey(labels map[string]string, key string) *string {
for k, v := range labels {
if k == key {
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/shared_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/pdok/mapserver-operator/internal/controller/featureinfogenerator"
"github.com/pdok/mapserver-operator/internal/controller/legendgenerator"
"github.com/pdok/mapserver-operator/internal/controller/mapfilegenerator"
"github.com/pdok/mapserver-operator/internal/controller/mapperutils"
"github.com/pdok/mapserver-operator/internal/controller/mapserver"
"github.com/pdok/mapserver-operator/internal/controller/ogcwebserviceproxy"
"github.com/pdok/mapserver-operator/internal/controller/static"
Expand Down Expand Up @@ -913,7 +912,7 @@ func mutateConfigMap[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O, configMap *cor
for _, name := range staticFileName {
content := contents[name]
if name == "include.conf" {
content = []byte(strings.ReplaceAll(string(content), "/{{ service_path }}", mapperutils.GetPath(obj)))
content = []byte(strings.ReplaceAll(string(content), "{{ service_path }}", pdoknlv3.GetBaseURLPath(obj)))
}
configMap.Data[name] = string(content)
}
Expand Down
Loading