This commit is contained in:
Mr Chen
2023-12-30 04:30:21 +08:00
parent b523b84609
commit 9dc3496c27
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ $config = array(
array(
'name' => 'local server', // Optional name.
'host' => '127.0.0.1',
'port' => 6379,
'port' => {$REDIS_PORT},
'filter' => '*',
'scheme' => 'tcp', // Optional. Connection scheme. 'tcp' - for TCP connection, 'unix' - for connection by unix domain socket
'path' => '', // Optional. Path to unix domain socket. Uses only if 'scheme' => 'unix'. Example: '/var/run/redis/redis.sock'
+14
View File
@@ -122,6 +122,18 @@ def getRedisPass():
return requirepass
def getRedisPort():
port = "6379"
conf = mw.getServerDir() + '/redis/redis.conf'
if os.path.exists(conf):
content = mw.readFile(conf)
rep = "^(" + 'port' + ')\s*([.0-9A-Za-z_& ~]+)'
tmp = re.search(rep, content, re.M)
if tmp:
port = tmp.groups()[1]
return port
def contentReplace(content):
service_path = mw.getServerDir()
php_ver = getCachePhpVer()
@@ -138,7 +150,9 @@ def contentReplace(content):
# REDIS_PASS
rd_pass = getRedisPass()
rd_port = getRedisPort()
content = content.replace('{$REDIS_PASS}', rd_pass)
content = content.replace('{$REDIS_PORT}', rd_port)
cfg = getCfg()