Older/Server/lua/accounts.lua
2024-06-17 16:27:43 +00:00

24 lines
510 B
Lua

local M = {}
local password_path = "password.txt"
function M.credentials()
local file = io.open(password_path, "r")
if not file then
ngx.log(ngx.INFO, "无法打开文件: ", password_path)
return
end
local credentials = {}
for line in file:lines() do
local account, password = line:match("([^=]+)=([^=]+)")
if account and password then
credentials[account] = password
end
end
file:close()
return credentials
end
return M