require "gds_api/worldwide"
require "gds_api/publishing_api_v2"

module Services
  def self.worldwide_api
    @worldwide_api ||= GdsApi::Worldwide.new(Plek.new.find("whitehall-admin"))
  end

  def self.publishing_api
    @publishing_api ||= GdsApi::PublishingApiV2.new(
      Plek.new.find("publishing-api"),
      bearer_token: ENV["PUBLISHING_API_BEARER_TOKEN"] || "example",
    )
  end
end

require "gds_api"
require "gds_api/publishing_api_v2"

module Services
  def self.worldwide_api
    @worldwide_api ||= GdsApi.worldwide
  end

  def self.publishing_api
    @publishing_api ||= GdsApi::PublishingApiV2.new(
      Plek.new.find("publishing-api"),
      bearer_token: ENV["PUBLISHING_API_BEARER_TOKEN"] || "example",
    )
  end
end

Access Worldwide API via whitehall-frontend
Access Worldwide API via whitehall-frontend

To simplify the migration of Whitehall to AWS, calls to the Worldwide
API should be directed to whitehall-frontend, not whitehall-admin.

Co-authored-by: Christopher Baines <c14e4e2094dd20d1d0dcfc7ec4547168bcc89be2@digital.cabinet-office.gov.uk>
