Refactor Impress 2020 config

I've moved the support secret into the encrypted credentials file, and
moved the origin into a top-level custom config value in the
environment files, with different defaults per environment but still
the ability to override it. (I don't use this, but it feels polite to
not actually *demand* that people use port 4000, y'know?)
This commit is contained in:
Emi Matchu 2024-02-22 13:07:43 -08:00
parent f8f805bf4d
commit 666394de25
8 changed files with 25 additions and 13 deletions

View file

@ -93,13 +93,15 @@ module ApplicationHelper
end
def impress_2020_meta_tags
impress_2020 = Rails.configuration.x.impress_2020
origin = Rails.configuration.impress_2020_origin
support_secret = Rails.application.credentials.impress_2020.support_secret
capture do
concat tag("meta", name: "impress-2020-origin",
content: impress_2020.origin)
if support_staff? && impress_2020.support_secret.present?
concat tag("meta", name: "impress-2020-origin", content: origin)
if support_staff? && support_secret.present?
concat tag("meta", name: "impress-2020-support-secret",
content: impress_2020.support_secret)
content: support_secret)
end
end
end

View file

@ -62,7 +62,7 @@ class Outfit < ApplicationRecord
end
IMAGE_URL_TEMPLATE = Addressable::Template.new(
Rails.configuration.x.impress_2020.origin +
Rails.configuration.impress_2020_origin +
"/api/outfitImage{?id,size,updatedAt}"
)
def image_versions

View file

@ -1 +1 @@
c2Us7svFW8MtlkzQwd0odiUhrm+D4gHTSbFURbdhv+fT56hTDdX5iGFDqm+5zuC0HmZgSzIvr6aR8y/FKIbLDmquqPNULRdNn1kKac8x8xxkdo820wiqlnSIDPgkJ8zGdJv+82YbSvGNH83kxi2ja9YwEbqajm46wpM7TKj37atZOlzMb/nuxgt8wKBuNR6UFV9rhyS4VW3Fu5sqs0tUT6gEacjj+CHfcz0RzwZ95NkIcKCq6zSN7IWDlmeh1oB6moYdBpCOx9KYaB2i1G2NOEX/0GJDzBa4h5QGc5UU2ASOiNB6O3a1x992yhykmJ6aNpvd9X4XSrMGe1PwXbOSfYugKtxK932HCn0aEfQZ551MlG689+7ePKQUjg9Dgfy6AIle2j/ZbVdGxR1Wr+QJa8kQrLtD5HwB--yMw4DtBiSZ1iZnOU--fl/rrhtcaNgEPv3G7URrRw==
b0WTE8+0LBv1VLmSEw0wmJJmjFctFHF9oIM4xKHJsWapYBppphc3Lvx+cCvIZRq9+K0KSR+ugkJKd+c8UqW0RxanjDFm4o7aZpxpI4WuKzqjcYhnBHXzx5HFdlLkXqPoU3NgSPvcPVPEk5AW5jPSCB7MBQOr4S5l1/mybJX4m0AlhoyXVAaPGOb0vZ3skk0eLeFn60aRq4TTrG7xiSkxfH5X0cOjPpNBmN/s03A8z72oYSy9Oa28V0GjFkXhxN9jnOpZJ/P3RBRovGInpcCFcle/EIUl/O+l9VP1tfR+szhBSbCXA2/wYedaZIvTuwF6iyCYz2k3lgD9qr3iQ+mACxoa/a2PE6grsSHD/FTzIcQPxmivoUFiRMtBdrJHCX6JUboprWG+y5SrQYFtJ0JkjpfnJYb4sqszMyQkvOP+GvQQ++CQFYHlD1fBweCKwFD6GNevj2AuCdxFGnCUn8Vjkj++qk8o63LsbO++6iFQXZnVMFC+7Cgq7Xnp74oDs1Jg9UD8uYHZcKQGcJv7y86BSAyuMb6lwlQqUhdfG7k/PpN0f2yC6JLAqKZ8VChTVjn62TIXkTenPY6ZsKwk9wstNAjVukCCGKXDt4uaRIurQnBT2lkTHdqnMIiYSEqBlvc/yAuDyxyXqndMvYhDsdetNdnIxATRkpA+mU4CHlgcv30J5l3obLN8UA0oHPL9lTMWU63E4JyQTwVEHGLy+J8TMZgJX1imCCzCzWL7ytdDy7HdZFXrVPxj+z95/PH//2NcvuAdwbnKX7Pk0ujEBwSnkmiw1UZgl5VT5G2yLwYqFY1VgyINBN42ynFFRfiNjk9Q9bIHk3i2bQnDAw9EtAuKbpdJ9IXboTAOHOIZpanW6RiIfIGk+MM5GLKOSthv6XCzhLue7P//tprHT85yE1vnhLNeCGg1EtgDlM9y--xXvKjFS/mwn+dHoa--u457xDa2Q8CLtVbYkL6pig==

View file

@ -102,4 +102,9 @@ Rails.application.configure do
# Allow connections on Vagrant's private network.
config.web_console.permissions = '10.0.2.2'
# Use a local copy of Impress 2020, presumably running on port 4000. (Can
# override this with the IMPRESS_2020_ORIGIN environment variable!)
config.impress_2020_origin = ENV.fetch("IMPRESS_2020_ORIGIN",
"http://localhost:4000")
end

View file

@ -121,4 +121,9 @@ Rails.application.configure do
# ]
# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
# Use the live copy of Impress 2020. (Can override this with the
# IMPRESS_2020_ORIGIN environment variable!)
config.impress_2020_origin = ENV.fetch("IMPRESS_2020_ORIGIN",
"https://impress-2020.openneo.net")
end

View file

@ -61,4 +61,9 @@ Rails.application.configure do
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
# Use a local copy of Impress 2020, presumably running on port 4000. (Can
# override this with the IMPRESS_2020_ORIGIN environment variable!)
config.impress_2020_origin = ENV.fetch("IMPRESS_2020_ORIGIN",
"http://localhost:4000")
end

View file

@ -1,5 +0,0 @@
Rails.configuration.x.impress_2020.origin =
ENV.fetch("IMPRESS_2020_ORIGIN", "https://impress-2020.openneo.net")
Rails.configuration.x.impress_2020.support_secret =
ENV.fetch("IMPRESS_2020_SUPPORT_SECRET", nil)

View file

@ -91,7 +91,7 @@ OpenneoImpressItems::Application.routes.draw do
# Static pages!
get '/terms', as: :terms,
to: redirect(Rails.configuration.x.impress_2020.origin + "/terms")
to: redirect(Rails.configuration.impress_2020_origin + "/terms")
# Other useful lil things!
get '/sitemap.xml' => 'sitemap#index', :as => :sitemap, :format => :xml