From 0b15cf9c1a51a43652b61fd6682e2f7320976aaf Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sat, 18 Jan 2020 21:25:50 +0500 Subject: [PATCH] redis: for child domain --- plogical/vhost.py | 15 +++++++++++++++ plogical/vhostConfs.py | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/plogical/vhost.py b/plogical/vhost.py index 0cb68e62e..22a1201b8 100755 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -846,6 +846,21 @@ class vhost: confFile.close() + else: + currentConf = vhostConfs.lswsRediConfChild + + currentConf = currentConf.replace('{virtualHostName}', domain) + currentConf = currentConf.replace('{masterDomain}', masterDomain) + currentConf = currentConf.replace('{administratorEmail}', administratorEmail) + currentConf = currentConf.replace('{path}', path) + currentConf = currentConf.replace('{externalApp}', virtualHostUser) + currentConf = currentConf.replace('{php}', phpVersion.lstrip('PHP ')) + currentConf = currentConf.replace('{uid}', str(pwd.getpwnam(virtualHostUser).pw_uid)) + currentConf = currentConf.replace('{gid}', str(grp.getgrnam(virtualHostUser).gr_gid)) + + command = 'redis-cli set %s' % (currentConf) + ProcessUtilities.executioner(command) + except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile( str(msg) + " [IO Error with per host config file [perHostDomainConf]]") diff --git a/plogical/vhostConfs.py b/plogical/vhostConfs.py index fbceb8a7b..7a74a3973 100755 --- a/plogical/vhostConfs.py +++ b/plogical/vhostConfs.py @@ -381,4 +381,21 @@ pm.max_spare_servers = {pmMaxSpareServers} CacheRoot lscache } +}'""" + + lswsRediConfChild = """"vhost:{virtualHostName}" '{ + "username": "{externalApp}", + "documentRoot": "{path}", + "vh_root": "{path}", + "uid": {uid}, + "gid": {gid}, + "phpVersion": {php}, + "custom_conf": { + ServerAlias www.{virtualHostName} + ServerAdmin {administratorEmail} + CustomLog /home/{masterDomain}/logs/{masterDomain}.access_log combined + + CacheRoot lscache + + } }'""" \ No newline at end of file