#!/usr/local/bin/ruby
#Waits for the dockerized geoserver to come up and serve the riskscape WFS
require 'net/http'
require 'time'

target = URI('http://riskscape-test-geoserver:8080/geoserver/wfs?request=GetCapabilities&version=1.0.0')
sleep_time = 2
while (true)
  begin
    response = Net::HTTP.get_response(target)
    if response.is_a?(Net::HTTPSuccess)
      break;
    end
  rescue
    #We don't want to stop waiting
  end
  sleep(sleep_time)
end
