Sha256: 70fb85bd04e6cfb9645abbc24af1e823415532749cfe95f685119a0bfb6154df

Contents?: true

Size: 555 Bytes

Versions: 5

Compression:

Stored size: 555 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true
# / 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"
}.freeze

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

5 entries across 5 versions & 1 rubygems

Version Path
github-pages-health-check-1.3.5 script/update-cdn-ips
github-pages-health-check-1.3.4 script/update-cdn-ips
github-pages-health-check-1.3.3 script/update-cdn-ips
github-pages-health-check-1.3.2 script/update-cdn-ips
github-pages-health-check-1.3.1 script/update-cdn-ips