From 21544a231094cb1c1d4124513162abfbad7a5bd9 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Wed, 22 Nov 2023 16:11:39 +0100
Subject: [PATCH] Move wms url setting to local_settings.py

---
 VIPSWeb/local_settings_sample.py     | 1 +
 VIPSWeb/templates/settings.js        | 3 ++-
 spatial/static/spatial/js/gridmap.js | 3 +--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/VIPSWeb/local_settings_sample.py b/VIPSWeb/local_settings_sample.py
index 090837b4..d0870a6f 100755
--- a/VIPSWeb/local_settings_sample.py
+++ b/VIPSWeb/local_settings_sample.py
@@ -138,6 +138,7 @@ SITE_OWNER_NAME = {"en":"FooBar Inc","nb":"ACME industrier"}
 SITE_OWNER_URL = "http://www.example.com/"
 
 # Grid models settings
+WMS_SERVER_URL = "https://gridweb.vips.nibio.no/cgi-bin/"
 AVAILABLE_GRID_MODELS = [
     {"model_id":"SEPTREFHUM", "model_name": {"nb":"Septoria referansefuktmodell", "en":"Septoria reference humidity model"}},
     {"model_id":"PSILARTEMP", "model_name": {"nb":"Gulrotflue svermetidspunktmodell", "en":"Carrot rust fly (Psila rosae) temperature model"}}
diff --git a/VIPSWeb/templates/settings.js b/VIPSWeb/templates/settings.js
index 2b34cf74..4659ca6c 100755
--- a/VIPSWeb/templates/settings.js
+++ b/VIPSWeb/templates/settings.js
@@ -59,5 +59,6 @@ var settings = {
 		},
 		
 		// The attribution shown in the corner of the map 
-	    MAP_ATTRIBUTION : "&copy; <a href='http://www.openstreetmap.org'>OpenStreetMap</a> contributors"
+	    MAP_ATTRIBUTION : "&copy; <a href='http://www.openstreetmap.org'>OpenStreetMap</a> contributors",
+		WMS_SERVER_URL: "{{settings.WMS_SERVER_URL}}"
 };
diff --git a/spatial/static/spatial/js/gridmap.js b/spatial/static/spatial/js/gridmap.js
index 160bb955..2f9a19ba 100644
--- a/spatial/static/spatial/js/gridmap.js
+++ b/spatial/static/spatial/js/gridmap.js
@@ -6,8 +6,7 @@ proj4.defs(
 
 let layers = [];
 
-let mapserverURL="https://testvips.nibio.no/cgi-bin/";
-//let mapserverURL="https://gridweb.vips.nibio.no/cgi-bin/";
+let mapserverURL=settings.WMS_SERVER_URL
 let modelId = undefined;
 let today = getSystemTime().format("YYYY-MM-DD");
 let todayLayerIndex = undefined;
-- 
GitLab