Older/Server/lua/accounts.lua

24 lines
510 B
Lua
Raw Normal View History

2024-06-18 00:27:43 +08:00
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