Extract neopets_origin into a config value

This commit is contained in:
Emi Matchu 2024-10-18 18:00:48 -07:00
parent e36e273d50
commit abfe1e6df7
2 changed files with 9 additions and 2 deletions

View file

@ -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')

View file

@ -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