Skip to content

Commit

Permalink
添加env json接口
Browse files Browse the repository at this point in the history
  • Loading branch information
hero1s committed May 17, 2024
1 parent 7ff9141 commit 4e27f2d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions script/basic/environ.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ function environ.table(key, str)
return ssplit(ogetenv(key) or "", str or ",")
end

function environ.json(key)
local value = ogetenv(key)
if value then
return json.decode(value)
end
end

local function parse_hosts(value)
local hosts = {}
local strs = ssplit(value, ",")
Expand Down

0 comments on commit 4e27f2d

Please sign in to comment.