Refactor auto-boot-ollama-host script into modular structure with separate configuration, network, SSH, and service management modules for improved maintainability and readability
This commit is contained in:
18
scripts/utils.lua
Normal file
18
scripts/utils.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Utility functions module for auto-boot-ollama-host
|
||||
-- Provides logging and other utility functions
|
||||
|
||||
local utils = {}
|
||||
|
||||
-- Logging function with timestamp
|
||||
function utils.log(msg)
|
||||
io.stdout:write(os.date("[%F %T] "), msg, "\n")
|
||||
io.stdout:flush()
|
||||
end
|
||||
|
||||
-- Get environment variable with default value
|
||||
function utils.getenv(name, def)
|
||||
local v = os.getenv(name)
|
||||
return (v ~= nil and v ~= "") and v or def
|
||||
end
|
||||
|
||||
return utils
|
||||
Reference in New Issue
Block a user