From 06d4db506129713912f12e083d25a51c9bd1fe0b Mon Sep 17 00:00:00 2001
From: Alain Takoudjou <alain.takoudjou@nexedi.com>
Date: Fri, 3 Aug 2018 18:53:55 +0200
Subject: [PATCH] re6stnet sr: allow to set parameter 'same-contry'

---
 software/re6stnet/instance-re6stnet-input-schema.json | 6 ++++++
 software/re6stnet/instance-re6stnet.cfg.in            | 1 +
 software/re6stnet/re6st-registry.conf.in              | 3 +++
 software/re6stnet/software.cfg                        | 4 ++--
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/software/re6stnet/instance-re6stnet-input-schema.json b/software/re6stnet/instance-re6stnet-input-schema.json
index c9443a9b0..f86eae38a 100644
--- a/software/re6stnet/instance-re6stnet-input-schema.json
+++ b/software/re6stnet/instance-re6stnet-input-schema.json
@@ -72,6 +72,12 @@
             "description": "Specify that tunnels should be encrypted.",
             "type": "boolean",
             "default": false
+        },
+        "same-country": {
+            "title": "Same Country",
+            "description": "Prevent tunnelling accross borders of listed countries",
+            "type": "string",
+            "default": ""
         }
     }
 }
\ No newline at end of file
diff --git a/software/re6stnet/instance-re6stnet.cfg.in b/software/re6stnet/instance-re6stnet.cfg.in
index 23ef9895e..ef257a01c 100644
--- a/software/re6stnet/instance-re6stnet.cfg.in
+++ b/software/re6stnet/instance-re6stnet.cfg.in
@@ -125,6 +125,7 @@ max-clients = {{ slapparameter_dict.get('max-clients', 0) }}
 hello = {{ slapparameter_dict.get('hello', 15) }}
 min-protocol = {{ slapparameter_dict.get('min-protocol', -1) }}
 encrypt = {{ slapparameter_dict.get('encrypt', 'False') }}
+same-country = {{ slapparameter_dict.get('same-country', '') }}
 
 [re6st-registry-conf]
 recipe = slapos.recipe.template:jinja2
diff --git a/software/re6stnet/re6st-registry.conf.in b/software/re6stnet/re6st-registry.conf.in
index 34603c646..26dacc19c 100644
--- a/software/re6stnet/re6st-registry.conf.in
+++ b/software/re6stnet/re6st-registry.conf.in
@@ -25,4 +25,7 @@ encrypt
 {% endif -%}
 {% if parameter_dict.get('max-clients') != '0' -%}
 max-clients {{ parameter_dict['max-clients'] }}
+{% endif -%}
+{% if parameter_dict.get('same-country') -%}
+same-country {{ parameter_dict['same-country'] }}
 {% endif -%}
\ No newline at end of file
diff --git a/software/re6stnet/software.cfg b/software/re6stnet/software.cfg
index 1f8ac52ab..b919d6356 100644
--- a/software/re6stnet/software.cfg
+++ b/software/re6stnet/software.cfg
@@ -87,7 +87,7 @@ extra-context =
 [template-re6stnet]
 < = download-base
 filename = instance-re6stnet.cfg.in
-md5sum = 6f28b611a0e2415768238f5e8d29d36e
+md5sum = 8c167f2adb2ed36aeaff773f59214981
 
 [template-apache-conf]
 < = download-base
@@ -97,7 +97,7 @@ md5sum = d64cafda1139b740a49a9f5e30a1b57b
 [template-re6st-registry-conf]
 < = download-base
 filename = re6st-registry.conf.in
-md5sum = 5dc218f887faeffc466e41c7d6191e49
+md5sum = b85375cd45c5f2fb0d68e449ae70e2a1
 
 [template-wrapper]
 < = download-base
-- 
2.30.9