Fix the CLINCH_HOST issue.

This commit is contained in:
Dan Milne
2025-10-26 21:59:27 +11:00
parent 52cfd6122c
commit b5b1d94d47
3 changed files with 7 additions and 6 deletions

View File

@@ -60,7 +60,7 @@ class OidcJwtService
def issuer_url
# In production, this should come from ENV or config
# For now, we'll use a placeholder that can be overridden
ENV.fetch("CLINCH_HOST", "http://localhost:3000")
"https://#{ENV.fetch("CLINCH_HOST", "localhost:3000")}"
end
private

View File

@@ -57,7 +57,9 @@ Rails.application.configure do
# config.action_mailer.raise_delivery_errors = false
# Set host to be used by links generated in mailer templates.
config.action_mailer.default_url_options = { host: "example.com" }
config.action_mailer.default_url_options = {
host: ENV.fetch('CLINCH_HOST', 'example.com')
}
# Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.
# config.action_mailer.smtp_settings = {

View File

@@ -64,15 +64,14 @@ class OidcUserConsentTest < ActiveSupport::TestCase
test "should set granted_at before validation on create" do
new_consent = OidcUserConsent.new(
user: users(:bob),
user: users(:alice),
application: applications(:another_app),
scopes_granted: "openid email"
)
assert_nil new_consent.granted_at
assert new_consent.save
assert new_consent.save!, "Should save successfully"
assert_not_nil new_consent.granted_at
# Should be very close to current time (allow 1 second variance)
assert_in_delta Time.current.to_f, new_consent.granted_at.to_f, 1.0
assert new_consent.granted_at.is_a?(Time), "granted_at should be a Time object"
end
test "scopes should parse space-separated scopes into array" do