feat(inferium-server): add delete-config endpoint
This commit is contained in:
parent
b88bc8a023
commit
a28ccbc920
@ -105,12 +105,26 @@ local function setConfig(message)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
LOCAL_CONFIGS[harvesterId] = config
|
|
||||||
saveConfigForComputer(harvesterId, config)
|
saveConfigForComputer(harvesterId, config)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
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 }[]
|
-- return a table of harvesters { id: string, name: string }[]
|
||||||
local function listHarvesters()
|
local function listHarvesters()
|
||||||
local result = {}
|
local result = {}
|
||||||
@ -135,6 +149,7 @@ end
|
|||||||
local ROUTES = {
|
local ROUTES = {
|
||||||
['get-config'] = getConfig,
|
['get-config'] = getConfig,
|
||||||
['set-config'] = setConfig,
|
['set-config'] = setConfig,
|
||||||
|
['delete-config'] = deleteConfig,
|
||||||
['list-harvesters'] = listHarvesters,
|
['list-harvesters'] = listHarvesters,
|
||||||
['exit-server'] = exitServer,
|
['exit-server'] = exitServer,
|
||||||
['upgrade-server'] = upgradeServer,
|
['upgrade-server'] = upgradeServer,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user