Skip to content

Commit 6208183

Browse files
author
Jelle Dijkstra
committed
Removed label->path logic
1 parent 4d743b3 commit 6208183

File tree

4 files changed

+4
-25
lines changed

4 files changed

+4
-25
lines changed

internal/controller/mapfilegenerator/mapper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func MapWFSToMapfileGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoperatorv
5757
Abstract: mapperutils.EscapeQuotes(wfs.Spec.Service.Abstract),
5858
Keywords: strings.Join(wfs.Spec.Service.KeywordsIncludingInspireKeyword(), ","),
5959
OnlineResource: pdoknlv3.GetHost(true),
60-
Path: mapperutils.GetPath(wfs),
60+
Path: "/" + pdoknlv3.GetBaseURLPath(wfs),
6161
MetadataID: metadataID,
6262
Extent: extent,
6363
NamespacePrefix: wfs.Spec.Service.Prefix,
@@ -198,7 +198,7 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, _ *smoothoperatorv1.OwnerI
198198
NamespacePrefix: datasetName,
199199
NamespaceURI: fmt.Sprintf("%s://%s.geonovum.nl", protocol, datasetName),
200200
OnlineResource: pdoknlv3.GetHost(true),
201-
Path: mapperutils.GetPath(wms),
201+
Path: "/" + pdoknlv3.GetBaseURLPath(wms),
202202
MetadataID: metadataID,
203203
DatasetOwner: &datasetOwner,
204204
AuthorityURL: &authorityURL,

internal/controller/mapfilegenerator/test_data/input/wfs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ spec:
9292
ownerInfoRef: ""
9393
prefix: prefix
9494
title: some Service title
95-
url: ""
95+
url: "http://localhost:32788/datasetOwner/dataset/theme/wfs/v1_0"

internal/controller/mapperutils/utils.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package mapperutils
22

33
import (
4-
"fmt"
54
"strings"
65

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

57-
func GetPath[O pdoknlv3.WMSWFS](obj O) (path string) {
58-
webserviceType := strings.ToLower(string(obj.Type()))
59-
datasetOwner := GetLabelValueByKey(obj.GetLabels(), "dataset-owner")
60-
dataset := GetLabelValueByKey(obj.GetLabels(), "dataset")
61-
theme := GetLabelValueByKey(obj.GetLabels(), "theme")
62-
serviceVersion := GetLabelValueByKey(obj.GetLabels(), "service-version")
63-
64-
path = fmt.Sprintf("/%s/%s", *datasetOwner, *dataset)
65-
if theme != nil {
66-
path += "/" + *theme
67-
}
68-
path += "/" + webserviceType
69-
if serviceVersion != nil {
70-
path += "/" + *serviceVersion
71-
}
72-
73-
return path
74-
}
75-
7656
func GetLabelValueByKey(labels map[string]string, key string) *string {
7757
for k, v := range labels {
7858
if k == key {

internal/controller/shared_controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/pdok/mapserver-operator/internal/controller/featureinfogenerator"
1717
"github.com/pdok/mapserver-operator/internal/controller/legendgenerator"
1818
"github.com/pdok/mapserver-operator/internal/controller/mapfilegenerator"
19-
"github.com/pdok/mapserver-operator/internal/controller/mapperutils"
2019
"github.com/pdok/mapserver-operator/internal/controller/mapserver"
2120
"github.com/pdok/mapserver-operator/internal/controller/ogcwebserviceproxy"
2221
"github.com/pdok/mapserver-operator/internal/controller/static"
@@ -913,7 +912,7 @@ func mutateConfigMap[R Reconciler, O pdoknlv3.WMSWFS](r R, obj O, configMap *cor
913912
for _, name := range staticFileName {
914913
content := contents[name]
915914
if name == "include.conf" {
916-
content = []byte(strings.ReplaceAll(string(content), "/{{ service_path }}", mapperutils.GetPath(obj)))
915+
content = []byte(strings.ReplaceAll(string(content), "{{ service_path }}", pdoknlv3.GetBaseURLPath(obj)))
917916
}
918917
configMap.Data[name] = string(content)
919918
}

0 commit comments

Comments
 (0)