bugfix(CLI): generate the 'worker_cpu_affinity' config for Linux OS (#1658)

Fix #1657
This commit is contained in:
Yousa 2020-06-09 20:44:15 +08:00 committed by GitHub
parent d780f7406f
commit 4b47391a6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -73,6 +73,18 @@ done
sed -i '/dns_resolver:/,+4s/^#//' conf/config.yaml
echo "passed: system nameserver imported"
# check whether the 'worker_cpu_affinity' is in nginx.conf .
make init
grep -E "worker_cpu_affinity" conf/nginx.conf > /dev/null
if [ ! $? -eq 0 ]; then
echo "failed: nginx.conf file is missing worker_cpu_affinity configuration"
exit 1
fi
echo "passed: nginx.conf file contains worker_cpu_affinity configuration"
# check admin https enabled
sed -i 's/\# port_admin: 9180/port_admin: 9180/' conf/config.yaml

View File

@ -21,6 +21,8 @@ local function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
-- Note: The `excute_cmd` return value will have a line break at the end,
-- it is recommended to use the `trim` function to handle the return value.
local function excute_cmd(cmd)
local t, err = io.popen(cmd)
if not t then
@ -676,7 +678,7 @@ local function init()
local sys_conf = {
lua_path = pkg_path_org,
lua_cpath = pkg_cpath_org,
os_name = excute_cmd("uname"),
os_name = trim(excute_cmd("uname")),
apisix_lua_home = apisix_home,
with_module_status = with_module_status,
error_log = {level = "warn"},