restore ngx variable config

This commit is contained in:
moicen
2022-01-28 21:24:53 +08:00
parent 2dbd3a9000
commit af7b91674e
2 changed files with 8 additions and 7 deletions
+2
View File
@@ -5,6 +5,8 @@ server {
listen 443 ssl;
client_max_body_size 10M;
set $resty_loc "/usr/local/openresty";
# disable in local test env
ssl_certificate /etc/letsencrypt/live/moicen.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/moicen.com/privkey.pem; # managed by Certbot
+6 -7
View File
@@ -5,18 +5,17 @@ local cjson = require "cjson"
local function upyun_upload_file()
local config = {
user = "moicen", --授权操作员名称
passwd = "NyJ51zRwFApY9Wo9EHJMrb8GI9YtvpVN", --操作员密码
user = ngx.var.upyun_operator,
passwd = ngx.var.upyun_password,
localFilePath = "/file_upload/abc.mp3"
}
local upyun = yun:new(config)
local bucket = ngx.var.upyun_bucket
local directory = 'test'
local savePath = bucket .. "/" .. directory .. "/abc.mp3"
local savePath = "huiwing/test/abc.mp3"
local gmkerl = nil
local options = nil
local info, err = upyun:upload_file(savePath, gmkerl, options)
local info, err = upyun:upload_file(savePath, nil, nil)
if not info then
ngx.say("failed to upload image file : " .. err)
return