24 lines
510 B
Lua
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
|