diff --git a/lib/lum.lua b/lib/lum.lua index 492bb39..c9c2474 100644 --- a/lib/lum.lua +++ b/lib/lum.lua @@ -3,8 +3,24 @@ local bin_path = "/bin/" local lib_path = "/lib/" local startup_path = "/startup/" +settings.define("lum.target_branch", { + description = "Target branch for updates", + type = "string", + default = "main" +}) + +settings.define("lum.log_level", { + description = "Log Level", + type = "string", + default = "debug" +}) + function download_lua(remote_path, local_path) - response = http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/" .. target_branch .. "/" .. remote_path .. ".lua", nil) + local url = "https://gitea.layla.gg/layla/computercraft/raw/branch/" .. settings.get("lum.target_branch") .. "/" .. remote_path .. ".lua" + if settings.get("lum.log_level") == "debug" then + io.write("Downloading " .. url .. " to " .. local_path .. "\n") + end + local response = http.get(url, nil) if response.getResponseCode() == 200 then file = fs.open(local_path, "w") file.write(response.readAll())