This commit is contained in:
midoks 2022-10-09 01:25:53 +08:00
parent 19173af3e2
commit 5cb2aefbbc
2 changed files with 8 additions and 2 deletions

View File

@ -186,10 +186,12 @@ def status():
def contentReplace(content):
service_path = mw.getServerDir()
waf_path = getServerDir() + "/waf"
waf_root = getServerDir()
waf_path = waf_root + "/waf"
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
content = content.replace('{$SERVER_PATH}', service_path)
content = content.replace('{$WAF_PATH}', waf_path)
content = content.replace('{$WAF_ROOT}', waf_root)
return content
@ -201,6 +203,10 @@ def initDreplace():
cmd = 'cp -rf ' + sdir + ' ' + path
mw.execShell(cmd)
logs_path = path + '/logs'
if not os.path.exists(logs_path):
mw.execShell('mkdir -p ' + logs_path)
config = path + '/waf/config.json'
content = mw.readFile(config)
content = json.loads(content)

View File

@ -1,7 +1,7 @@
local cpath = "{$WAF_PATH}/"
local rpath = "{$WAF_PATH}/rule/"
local logdir = "{$ROOT_PATH}/wwwlogs/waf/"
local logdir = "{$WAF_ROOT}/logs/"
local json = require "cjson"
local ngx_match = ngx.re.find