local backendHash = "7ca0a34e9c4c065b7bfad0623db0e322bf3e0af9"
local dataProvider = "data.openspaceproject.com/files/webgui"

local backend = asset.syncedResource({
  Identifier = "WebGuiBackend",
  Name = "Web Gui Backend",
  Type = "UrlSynchronization",
  Url = dataProvider .. "/backend/" ..  backendHash .. "/backend.zip"
})

asset.onInitialize(function ()
  -- Unzip the server bundle
  local dest = backend .. "/backend"
  if not openspace.directoryExists(dest) then
    openspace.unzipFile(backend .. "backend.zip", dest, true)
  end

  openspace.setPropertyValueSingle(
    "Modules.WebGui.ServerProcessEntryPoint", backend .. "/backend/backend.js"
  )
end)
