From d47f4a3cb3c4598eddd2d0b3fca51209c8055712 Mon Sep 17 00:00:00 2001
From: Fabian Schindler <fabian.schindler.strauss@gmail.com>
Date: Wed, 3 Aug 2022 12:01:17 +0200
Subject: [PATCH] Updating registrar chart for new schema

---
 .../vs-registrar/files/registrar-config.yaml  | 56 +++++++------------
 charts/vs-registrar/values.yaml               |  7 +--
 2 files changed, 22 insertions(+), 41 deletions(-)

diff --git a/charts/vs-registrar/files/registrar-config.yaml b/charts/vs-registrar/files/registrar-config.yaml
index bf77081..486e340 100644
--- a/charts/vs-registrar/files/registrar-config.yaml
+++ b/charts/vs-registrar/files/registrar-config.yaml
@@ -32,40 +32,24 @@ sources:
       endpoint_url: {{ $val.endpoint_url | default "null" }}
     {{- end }}
 {{- end }}
-
-backends:
-  {{- if not ( .Values.config.disableDefaultEoxserver ) }}
-  - type: eoxserver
-    path: registrar.backend.eoxserver.EOxServerBackend
-    kwargs:
-      instance_base_path: {{ .Values.config.eoxserverInstanceBasePath }}
-      instance_name: {{ .Values.config.eoxserverInstanceName }}
-      product_types:
-      {{- range $prod_type_val := .Values.global.productTypes -}}
-      {{- if ( $.Values.config.removeBrowsesFromConfig ) }}
-        {{- $prod_type_val := unset $prod_type_val "browses" }}
-      {{- end }}
-      {{- $prod_type_val := unset $prod_type_val "defaultBrowse" }}
-      -{{- toYaml $prod_type_val | nindent 10 -}}
-      {{- end -}}
+routes:
+  {{- if not ( .Values.config.disableDefaultRoute ) }}
+  items:
+    path: registrar.route.stac.ItemRoute
+    replace: true
+    queue: register
+    backends:
+      - path: registrar.backend.eoxserver.ItemBackend
+        kwargs:
+          instance_base_path: {{ .Values.config.eoxserverInstanceBasePath }}
+          instance_name: {{ .Values.config.eoxserverInstanceName }}
+          product_types:
+          {{- range $prod_type_val := .Values.global.productTypes -}}
+          {{- if ( $.Values.config.removeBrowsesFromConfig ) }}
+            {{- $prod_type_val := unset $prod_type_val "browses" }}
+          {{- end }}
+          {{- $prod_type_val := unset $prod_type_val "defaultBrowse" }}
+          -{{- toYaml $prod_type_val | nindent 14 -}}
+          {{- end -}}
   {{- end }}
-  {{- range .Values.config.backends }}
-  -{{ toYaml . | nindent 6 }}
-  {{- end }}
-
-{{- if not (empty .Values.config.pathBackends) }}
-path_backends:
-{{- range .Values.config.pathBackends }}
--{{ toYaml . | nindent 6 }}
-{{- end }}
-{{- end }}
-
-{{- if not (empty .Values.config.preHandlers) }}
-pre_handlers:
-  {{- toYaml .Values.config.preHandlers | nindent 4 -}}
-{{- end }}
-
-{{- if not (empty .Values.config.postHandlers) }}
-post_handlers:
-  {{- toYaml .Values.config.postHandlers | nindent 4 -}}
-{{- end }}
+  {{- toYaml .Values.config.routes | nindent 2 -}}
diff --git a/charts/vs-registrar/values.yaml b/charts/vs-registrar/values.yaml
index 520c0a6..72f4f51 100644
--- a/charts/vs-registrar/values.yaml
+++ b/charts/vs-registrar/values.yaml
@@ -23,13 +23,10 @@ volumeMounts: []
 volumes: []
 
 config:
-  disableDefaultEoxserver: false
-  backends: []
-  pathBackends: []
-  preHandlers: []
-  postHandlers: []
+  disableDefaultRoute: false
   eoxserverInstanceBasePath: "/var/www/pvs/dev"
   eoxserverInstanceName: "pvs_instance"
+  routes: {}
 
 global:
   env:
-- 
GitLab