futriix/lua_script/init.lua

39 lines
1.5 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- lua_scripts/init.lua
-- Инициализационный Lua скрипт для Futriix Server
-- Автоматически выполняется при старте сервера для настройки окружения
-- Этот скрипт инициализирует глобальные функции, создает системные коллекции
-- и настраивает базовую конфигурацию сервера.
falcot_log("Initializing Futriix Server v1.0.0 with Lua scripting...")
-- Создаем глобальные функции для бэкапов
function futriix.engine.backup.start()
return futriix_db.backup_start()
end
function futriix.engine.backup.restore(backup_path)
return futriix_db.backup_restore(backup_path)
end
-- Пример создания коллекции при старте с временной меткой
local current_timestamp = os.date("%d-%m-%Y")
futriix_db.create("system_config", '{"key": "server_start_time", "value": "' .. current_timestamp .. '"}')
falcot_log("System configuration initialized with timestamp: " .. current_timestamp)
-- Пример ACL проверки
function check_access(ip_address)
if ip_address == "127.0.0.1" then
return true
end
return false
end
-- Логирование информации о кластере
if futriix.cluster.enabled then
falcot_log("Cluster mode enabled: " .. futriix.cluster.name)
else
falcot_log("Standalone mode enabled")
end
falcot_log("Lua initialization script completed")