Skip to content

Commit

Permalink
feat: 拆分页面转发插件
Browse files Browse the repository at this point in the history
feat: 调整路径配置
feat: 补充示例模板方法参数
feat: 调整sync插件日志输出位置
feat: 补充官网文件
feat: 即将支持一系列插件
feat: 事务日程调整
  • Loading branch information
iamtsm committed Aug 18, 2022
1 parent 6594956 commit b63dbcd
Show file tree
Hide file tree
Showing 41 changed files with 1,971 additions and 34 deletions.
2 changes: 1 addition & 1 deletion api/router/tl_ops_api_get_store.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cjson.encode_empty_table_as_object(false)

-- 读取文件
local read = function( filename )
local store_file_name = tl_ops_manage_env.log.store_dir .. filename
local store_file_name = tl_ops_manage_env.path.store .. filename
local store_file_io, _ = io.open(store_file_name, "r")
if not store_file_io then
tlog:err("failed to open file in read: " .. store_file_name)
Expand Down
14 changes: 13 additions & 1 deletion conf/tl_ops_manage.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,19 @@ server {
}

location /tlopsmanage/ {
alias /path/to/tl-ops-manage/web/;
set $tlopsmanage "";
alias $tlopsmanage;
rewrite_by_lua_block {
tlops:tl_ops_process_init_rewrite('onlyplugin');
}
}

location /website/ {
set $website "";
alias $website;
rewrite_by_lua_block {
tlops:tl_ops_process_init_rewrite('onlyplugin');
}
}

location /balanceerr/ {
Expand Down
17 changes: 17 additions & 0 deletions doc/change.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@

## 事务更新日程

2022-08-18

1. 拆分页面转发插件

2. 调整路径配置

3. 补充示例模板方法参数

4. 调整sync插件日志输出位置

5. 补充官网文件

6. 即将支持一系列插件

7. 事务日程调整


2022-08-10

1. 支持集群数据同步
Expand Down
8 changes: 5 additions & 3 deletions doc/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@

- [ ] 支持自定义回源缓存

- [ ] 支持动态插拔插件

- [ ] 支持动态自定义数据源


- [ ] 支持多协议转换转发

Expand All @@ -100,9 +104,7 @@

- [ ] 【插件】支持请求ID追踪

- [ ] 【插件】支持请求耗时统计

- [ ] 【插件】支持请求告警通知
- [ ] 【插件】支持请求耗时统计告警

- [ ] 【插件】支持权限身份控制

Expand Down
3 changes: 3 additions & 0 deletions plugins/tl_ops_cors/tl_ops_plugin_constant.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {

}
51 changes: 51 additions & 0 deletions plugins/tl_ops_cors/tl_ops_plugin_core.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-- tl_ops_plugin_cors
-- en : cors
-- zn : 跨域插件
-- @author iamtsm
-- @email [email protected]

local tlog = require("utils.tl_ops_utils_log"):new("tl_ops_plugin_cors");
local tl_ops_utils_func = require("utils.tl_ops_utils_func");

local _M = {
_VERSION = '0.01'
}

local mt = { __index = _M }


function _M:new(options)
if not options then
options = {}
end
return setmetatable(options, mt)
end


function _M:tl_ops_process_before_init_access(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_access(ctx)


return true, "ok"
end

function _M:tl_ops_process_before_init_header(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_header(ctx)


return true, "ok"
end



return _M
3 changes: 3 additions & 0 deletions plugins/tl_ops_jwt/tl_ops_plugin_constant.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {

}
62 changes: 62 additions & 0 deletions plugins/tl_ops_jwt/tl_ops_plugin_core.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
-- tl_ops_plugin_jwt
-- en : jwt
-- zn : jwt权限认证插件
-- @author iamtsm
-- @email [email protected]

local tlog = require("utils.tl_ops_utils_log"):new("tl_ops_plugin_jwt");
local tl_ops_utils_func = require("utils.tl_ops_utils_func");

local _M = {
_VERSION = '0.01'
}

local mt = { __index = _M }


function _M:new(options)
if not options then
options = {}
end
return setmetatable(options, mt)
end


function _M:tl_ops_process_before_init_rewrite(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_rewrite(ctx)


return true, "ok"
end

function _M:tl_ops_process_before_init_access(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_access(ctx)


return true, "ok"
end

function _M:tl_ops_process_before_init_header(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_header(ctx)


return true, "ok"
end


return _M
3 changes: 3 additions & 0 deletions plugins/tl_ops_log_analyze/tl_ops_plugin_constant.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {

}
122 changes: 122 additions & 0 deletions plugins/tl_ops_log_analyze/tl_ops_plugin_core.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
-- tl_ops_plugin_log_analyze
-- en : log_analyze
-- zn : 日志分析插件
-- @author iamtsm
-- @email [email protected]

local tlog = require("utils.tl_ops_utils_log"):new("tl_ops_plugin_log_analyze");
local tl_ops_utils_func = require("utils.tl_ops_utils_func");

local _M = {
_VERSION = '0.01'
}

local mt = { __index = _M }


function _M:new(options)
if not options then
options = {}
end
return setmetatable(options, mt)
end


function _M:tl_ops_process_before_init_worker()


return true, "ok"
end

function _M:tl_ops_process_after_init_worker()


return true, "ok"
end

function _M:tl_ops_process_before_init_ssl()


return true, "ok"
end

function _M:tl_ops_process_after_init_ssl()


return true, "ok"
end

function _M:tl_ops_process_before_init_rewrite(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_rewrite(ctx)


return true, "ok"
end

function _M:tl_ops_process_before_init_access(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_access(ctx)


return true, "ok"
end

function _M:tl_ops_process_before_init_balancer(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_balancer(ctx)


return true, "ok"
end

function _M:tl_ops_process_before_init_header(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_header(ctx)


return true, "ok"
end

function _M:tl_ops_process_before_init_body(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_body(ctx)


return true, "ok"
end

function _M:tl_ops_process_before_init_log(ctx)


return true, "ok"
end

function _M:tl_ops_process_after_init_log(ctx)


return true, "ok"
end


return _M
3 changes: 3 additions & 0 deletions plugins/tl_ops_page_proxy/tl_ops_plugin_constant.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {

}
42 changes: 42 additions & 0 deletions plugins/tl_ops_page_proxy/tl_ops_plugin_core.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-- tl_ops_plugin_page_proxy
-- en : page_proxy
-- zn : 页面转发插件
-- @author iamtsm
-- @email [email protected]

local utils = tlops.utils
local env = tlops.env

local _M = {
_VERSION = '0.01'
}

local mt = { __index = _M }


function _M:new(options)
if not options then
options = {}
end
return setmetatable(options, mt)
end


-- 页面转发插件实现
function _M:tl_ops_process_before_init_rewrite(ctx)

local request_uri = utils:get_req_uri()

if ngx.re.find(request_uri, "/tlopsmanage/", 'jo') then
ngx.var.tlopsmanage = env.path.tlopsmanage
end

if ngx.re.find(request_uri, "/website/", 'jo') then
ngx.var.website = env.path.website
end

return true, "ok"
end


return _M
2 changes: 1 addition & 1 deletion plugins/tl_ops_sync/sync_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ local cache_waf = tlops.cache.waf
local utils = tlops.utils
local cjson = require("cjson.safe");
cjson.encode_empty_table_as_object(false)
local tlog = require("utils.tl_ops_utils_log"):new("tl_ops_plugin_sync_data");
local tlog = require("utils.tl_ops_utils_log"):new("tl_ops_plugin_sync");


local _M = {
Expand Down
2 changes: 1 addition & 1 deletion plugins/tl_ops_sync/sync_fields.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local tl_ops_limit_fuse_check_version = require("limit.fuse.tl_ops_limit_fus
local tl_ops_health_check_version = require("health.tl_ops_health_check_version")
local cjson = require("cjson.safe");
cjson.encode_empty_table_as_object(false)
local tlog = require("utils.tl_ops_utils_log"):new("tl_ops_plugin_sync_fields");
local tlog = require("utils.tl_ops_utils_log"):new("tl_ops_plugin_sync");


local _M = {
Expand Down
Loading

0 comments on commit b63dbcd

Please sign in to comment.