diff --git a/inferium-server.lua b/inferium-server.lua index ba366bd..35d015a 100644 --- a/inferium-server.lua +++ b/inferium-server.lua @@ -3,7 +3,7 @@ local utils = require('libs/utils') local inferium = require('config/inferium') local DEFAULT_HARVESTER_NAME = 'harvester' -local VERSION = "2.0.0" +local VERSION = "2.0.1" local INFERIUM_SERVER = 'inferium.com' local PERSISTED_CONFIGS = '/data/inferium-configs' @@ -76,15 +76,18 @@ end -- Routes -local function getConfig(_, computerId) +local function getConfig(message, computerId) if not computerId == nil then print('get-config error: no computerId found') return nil end - local config = getConfigForComputer(computerId) + local givenHarvesterId = message and message.payload and message.payload.id - if not config then + local id = givenHarvesterId or computerId + local config = getConfigForComputer(id) + + if not givenHarvesterId and not config then print('new harvester detected: ' .. tostring(computerId)) saveConfigForComputer(computerId, defaultConfig) config = defaultConfig