Skip to content

refactor: allow production license URL override#5

Open
Aditya-Rai-25 wants to merge 2 commits into
mainfrom
license-url-override
Open

refactor: allow production license URL override#5
Aditya-Rai-25 wants to merge 2 commits into
mainfrom
license-url-override

Conversation

@Aditya-Rai-25

@Aditya-Rai-25 Aditya-Rai-25 commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Issue No: #6

This PR refactors the production license verification flow to support a configurable license verification URL.

The LAGO_LICENSE_URL environment variable can now be used to override the default production Lago license verification URL. This allows Mango Cloud deployments to route license verification requests to a custom entitlement API server, which can validate the configured LAGO_LICENSE key.

Changes include:

add support for LAGO_LICENSE_URL environment variable
use the custom license URL when LAGO_LICENSE_URL is configured
keep the existing production license verification URL as the default fallback
allow custom entitlement API integration for license validation

This change is required for Mango Cloud billing integration, where license verification needs to be handled by a custom entitlement API server instead of the default upstream Lago license verification endpoint.

 - Use the LAGO_LICENSE_URL environment variable to override the
   production license verification URL.
 - This allows a custom entitlement API server to receive the license
   verification request and validate the configured LAGO_LICENSE key.

@njonty njonty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR removes the existing staging/Lago Cloud behavior:

LAGO_CLOUD=true + RAILS_ENV=staging previously used http://license-web.default.svc.cluster.local

Now it always uses LAGO_LICENSE_URL or falls back to https://license.getlago.com . That may break staging cloud deployments unless they explicitly set LAGO_LICENSE_URL.

Suggested fix:
config.license_url = ENV.fetch("LAGO_LICENSE_URL") do
if ENV["LAGO_CLOUD"] == "true" && ENV["RAILS_ENV"] == "staging"
"http://license-web.default.svc.cluster.local"
else
"https://license.getlago.com"
end
end

 - Refactor production license URL to support LAGO_LICENSE_URL override while preserving cloud staging fallback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants