auto replace lua script path
This commit is contained in:
@@ -21,10 +21,18 @@ cp conf/alchemy/*.conf $openresty_sub_config_dir
|
||||
openresty_install_path=$(openresty -V 2>&1 | tr '\n' '\f' | sed -r 's/.*--prefix=(.*)[[:space:]]--with-cc.*/\1/')
|
||||
openresty_lua_scripts_dir=$openresty_install_path/scripts
|
||||
echo $openresty_lua_scripts_dir
|
||||
|
||||
# -- Make scripts dir
|
||||
mkdir -p $openresty_lua_scripts_dir
|
||||
|
||||
# -- Copy scripts file
|
||||
cp scripts/*.lua $openresty_lua_scripts_dir
|
||||
# -- Replace scripts path in file
|
||||
replaced_scripts_path=$(echo $openresty_lua_scripts_dir | sed 's_/_\\/_g')
|
||||
echo "$replaced_scripts_path"
|
||||
sed -i -e "s/\$script_path/$replaced_scripts_path/" \
|
||||
"$openresty_lua_scripts_dir"/combine.lua \
|
||||
"$openresty_lua_scripts_dir"/convert_audio.lua \
|
||||
"$openresty_lua_scripts_dir"/test_upyun_upload.lua \
|
||||
"$openresty_lua_scripts_dir"/upyun_upload.lua
|
||||
|
||||
# Reload openresty
|
||||
openresty -t
|
||||
|
||||
@@ -21,10 +21,18 @@ cp conf/local_macos/*.conf $openresty_sub_config_dir
|
||||
openresty_install_path=$(openresty -V 2>&1 | tr '\n' '\f' | sed -r 's/.*--prefix=(.*)[[:space:]]--with-cc.*/\1/')
|
||||
openresty_lua_scripts_dir=$openresty_install_path/scripts
|
||||
echo $openresty_lua_scripts_dir
|
||||
|
||||
# -- Make scripts dir
|
||||
mkdir -p $openresty_lua_scripts_dir
|
||||
|
||||
# -- Copy scripts file
|
||||
cp scripts/*.lua $openresty_lua_scripts_dir
|
||||
# -- Replace scripts path in file
|
||||
replaced_scripts_path=$(echo $openresty_lua_scripts_dir | sed 's_/_\\/_g')
|
||||
echo "$replaced_scripts_path"
|
||||
sed -i -e "s/\$script_path/$replaced_scripts_path/" \
|
||||
"$openresty_lua_scripts_dir"/combine.lua \
|
||||
"$openresty_lua_scripts_dir"/convert_audio.lua \
|
||||
"$openresty_lua_scripts_dir"/test_upyun_upload.lua \
|
||||
"$openresty_lua_scripts_dir"/upyun_upload.lua
|
||||
|
||||
# Reload openresty
|
||||
openresty -t
|
||||
|
||||
@@ -21,10 +21,18 @@ cp conf/moicen/*.conf $openresty_sub_config_dir
|
||||
openresty_install_path=$(openresty -V 2>&1 | tr '\n' '\f' | sed -r 's/.*--prefix=(.*)[[:space:]]--with-cc.*/\1/')
|
||||
openresty_lua_scripts_dir=$openresty_install_path/scripts
|
||||
echo $openresty_lua_scripts_dir
|
||||
|
||||
# -- Make scripts dir
|
||||
mkdir -p $openresty_lua_scripts_dir
|
||||
|
||||
# -- Copy scripts file
|
||||
cp scripts/*.lua $openresty_lua_scripts_dir
|
||||
# -- Replace scripts path in file
|
||||
replaced_scripts_path=$(echo $openresty_lua_scripts_dir | sed 's_/_\\/_g')
|
||||
echo "$replaced_scripts_path"
|
||||
sed -i -e "s/\$script_path/$replaced_scripts_path/" \
|
||||
"$openresty_lua_scripts_dir"/combine.lua \
|
||||
"$openresty_lua_scripts_dir"/convert_audio.lua \
|
||||
"$openresty_lua_scripts_dir"/test_upyun_upload.lua \
|
||||
"$openresty_lua_scripts_dir"/upyun_upload.lua
|
||||
|
||||
# Reload openresty
|
||||
openresty -t
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
-- 指定模块引用目录,否则无法加载同目录下的其他文件
|
||||
package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
||||
--package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
||||
package.path = package.path .. ';$script_path/?.lua';
|
||||
|
||||
local uuid = require "resty.jit-uuid"
|
||||
local cjson = require "cjson"
|
||||
local upyun_upload = require("upyun_upload")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
-- 指定模块引用目录,否则无法加载同目录下的其他文件
|
||||
package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
||||
--package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
||||
package.path = package.path .. ';$script_path/?.lua';
|
||||
|
||||
local cjson = require "cjson"
|
||||
local uuid = require "resty.jit-uuid"
|
||||
local http = require "resty.http"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
||||
-- 指定模块引用目录,否则无法加载同目录下的其他文件
|
||||
--package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
||||
package.path = package.path .. ';$script_path/?.lua';
|
||||
|
||||
local yun = require("upyun")
|
||||
local cjson = require "cjson"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-- 指定模块引用目录,否则无法加载同目录下的其他文件
|
||||
package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
||||
--package.path = package.path .. ';/usr/local/opt/openresty/nginx/scripts/?.lua';
|
||||
package.path = package.path .. ';$script_path/?.lua';
|
||||
|
||||
local upyun_upload = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user