diff --git a/app/services/neopets/custom_pets.rb b/app/services/neopets/custom_pets.rb index 98548de1..b7d468da 100644 --- a/app/services/neopets/custom_pets.rb +++ b/app/services/neopets/custom_pets.rb @@ -1,8 +1,9 @@ require 'rocketamf_extensions/remote_gateway' module Neopets::CustomPets - NEOPETS_URL_ORIGIN = ENV['NEOPETS_URL_ORIGIN'] || 'https://www.neopets.com' - GATEWAY_URL = NEOPETS_URL_ORIGIN + '/amfphp/gateway.php' + GATEWAY_URL = + Addressable::URI.parse(Rails.configuration.neopets_origin) + + '/amfphp/gateway.php' GATEWAY = RocketAMFExtensions::RemoteGateway.new(GATEWAY_URL) CUSTOM_PET_SERVICE = GATEWAY.service('CustomPetService') PET_SERVICE = GATEWAY.service('PetService') diff --git a/config/application.rb b/config/application.rb index 7c3340f6..9aee54a2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -72,6 +72,12 @@ module OpenneoImpressItems # version number, etc. So let's only send this to Neopets systems, where it # should hopefully be clear who we are from context! config.user_agent_for_neopets = "Dress to Impress" + + # Use the usual Neopets.com, unless we have an override. (At times, we've + # used this in collaboration with TNT to address the server directly, + # instead of through the CDN.) + config.neopets_origin = + ENV.fetch('NEOPETS_URL_ORIGIN', 'https://www.neopets.com') end end