Sha256: 048b6536dce301c06c7f7b2f98029272384c42cad0c6b69328ab019a8748d77f

Contents?: true

Size: 510 Bytes

Versions: 2

Compression:

Stored size: 510 Bytes

Contents

#!/usr/bin/env ruby
#/ Usage script/update-ips
#/ updates config/cloudflare-ips.txt and config/fastly-ips.txt

require 'open-uri'
require 'json'

SOURCES = {
  cloudflare: "https://www.cloudflare.com/ips-v4",
  fastly: "https://api.fastly.com/public-ip-list"
}

SOURCES.each do |source, url|
  file = "config/#{source}-ips.txt"
  puts "Fetching #{url}..."
  data = open(url).read
  data = JSON.parse(data)["addresses"].join("\n") if source == :fastly
  File.write(file, data)
  `git add --verbose #{file}`
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
github-pages-health-check-1.3.0 script/update-cdn-ips
github-pages-health-check-1.2.0 script/update-cdn-ips