docbrown/app/services/edge_cache/bust/fastly.rb
Daniel Uber c6c30d58ab
Remove fastly http purge feature flag and conditional behavior (#16903)
* Always use purge, never post, to fastly

* Remove unneeded feature flag
2022-03-18 09:10:43 -05:00

29 lines
643 B
Ruby

module EdgeCache
class Bust
class Fastly
# [@forem/systems] Fastly-enabled Forems don't need "flexible" domains.
def self.call(path)
api_key = ApplicationConfig["FASTLY_API_KEY"]
fastly_purge(api_key, path)
end
def self.fastly_purge(api_key, path)
fastly = ::Fastly.new(api_key: api_key)
urls(path).map do |url|
fastly.purge(url)
end
end
private_class_method :fastly_purge
def self.urls(path)
[
URL.url(path),
URL.url("#{path}?i=i"),
]
end
private_class_method :fastly_purge
end
end
end