diff --git a/inferium-server.lua b/inferium-server.lua index d6cb466..ba366bd 100644 --- a/inferium-server.lua +++ b/inferium-server.lua @@ -105,12 +105,26 @@ local function setConfig(message) return false end - LOCAL_CONFIGS[harvesterId] = config saveConfigForComputer(harvesterId, config) - return true end +local function deleteConfig(message) + local payload = message and message.payload + local harvesterId = payload and payload.id + + if not harvesterId then + return false + end + + if LOCAL_CONFIGS[harvesterId] then + saveConfigForComputer(harvesterId, nil) + return true + end + + return false +end + -- return a table of harvesters { id: string, name: string }[] local function listHarvesters() local result = {} @@ -135,6 +149,7 @@ end local ROUTES = { ['get-config'] = getConfig, ['set-config'] = setConfig, + ['delete-config'] = deleteConfig, ['list-harvesters'] = listHarvesters, ['exit-server'] = exitServer, ['upgrade-server'] = upgradeServer,