From 069a304882df39732ef1dcc3be4559663f9d61b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Wed, 21 Jun 2017 15:54:32 +0200
Subject: [PATCH] Fixed script to set domain (refs #21163).

---
 set_app_domain.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/set_app_domain.py b/set_app_domain.py
index fa46bfd8..7c2fbc43 100755
--- a/set_app_domain.py
+++ b/set_app_domain.py
@@ -25,7 +25,6 @@ class SetAppDomain():
     domain: The new domain.''' % __file__
     UNIX_USER_PATTERN = r'[a-z0-9\-]+'
     DOMAIN_PATTERN = r'[a-z0-9\-]+\.[a-z0-9\-]+\.[a-z]+'
-    NGINX_SERVER_NAME_PATTERN = r'\s*server_name\s+([\w\-\_\.\ ]+);'
 
     def __init__(self, *args):
         args = list(args)
@@ -100,8 +99,8 @@ class SetAppDomain():
         new_vhost = ''
         changed_lines = 0
         for line in vhost.split('\n'):
-            if re.match(self.NGINX_SERVER_NAME_PATTERN, line):
-                new_vhost += re.sub(self.NGINX_SERVER_NAME_PATTERN, line, new_domain) + '\n'
+            if re.match(r'\s*server_name\s+([\w\-\_\.\ ]+);', line):
+                new_vhost += re.sub(r'server_name\s+([\w\-\_\.\ ]+);', line, 'server_name %s;' % new_domain) + '\n'
                 changed_lines += 1
             else:
                 new_vhost += line + '\n'
-- 
GitLab