Skip to content

Comments

Stage env#283

Merged
jigar-f merged 22 commits intomainfrom
jigar/stage-env
Feb 20, 2026
Merged

Stage env#283
jigar-f merged 22 commits intomainfrom
jigar/stage-env

Conversation

@jigar-f
Copy link
Contributor

@jigar-f jigar-f commented Jan 7, 2026

This pull request refactors how API endpoint URLs are managed throughout the codebase, introducing environment-aware URL selection to support both production and staging environments. The changes centralize URL definitions and logic in the common package, replacing hardcoded URLs in multiple modules. Additionally, the Kindling client is updated to handle staging environments more gracefully, and a utility function for setting environment variables in-memory is added.

Environment-aware URL management:

  • Added ProServerURL, StageProServerURL, BaseURL, and StageBaseURL constants and corresponding GetProServerURL() and GetBaseURL() functions to common/constants.go for dynamic selection of API endpoints based on environment. Also added a Stage() function in common/init.go to detect staging mode. [1] [2]
  • Replaced all hardcoded API URLs in api/api.go, api/subscription.go, api/user.go, config/fetcher.go, and issue/issue.go with calls to the new common.GetProServerURL() and common.GetBaseURL() functions, ensuring correct URLs are used for production or staging. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Kindling client improvements:

  • Updated kindling/client.go so that when running in staging, domain fronting is disabled and the staging API endpoint is added to proxyless hosts, improving reliability against staging server issues.

Environment variable utilities:

  • Added a Set function to common/env/env.go to allow in-memory and OS-level updates of environment variables, making it easier to change environment settings at runtime for testing or configuration purposes.

These changes make the codebase more flexible and robust when switching between production and staging environments, and reduce the risk of errors from hardcoded URLs.

@jigar-f jigar-f self-assigned this Feb 13, 2026
@jigar-f jigar-f marked this pull request as ready for review February 13, 2026 11:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces environment-aware API endpoint management to support both production and staging environments. It centralizes URL definitions in the common package and updates all API calls throughout the codebase to use environment-specific URLs. The Kindling HTTP client is also modified to disable domain fronting in staging mode and add the staging server to proxyless hosts.

Changes:

  • Added environment detection (Stage()) and URL getter functions (GetProServerURL(), GetBaseURL()) in the common package
  • Replaced hardcoded API URLs across multiple modules with calls to centralized URL getter functions
  • Modified Kindling client to handle staging environments differently (disabling domain fronting)
  • Added Set() function to env package for runtime environment variable updates
  • Removed unused sing-dns dependency
  • Increased max uncompressed log size from 40 MB to 50 MB in issue reporter

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
common/constants.go Added URL constants for production and staging, with getter functions
common/init.go Added Stage() function for staging environment detection
common/env/env.go Added Set() function for runtime environment variable updates
kindling/client.go Modified to disable domain fronting and use different transports in staging
api/api.go Updated to use centralized URL getters for pro-server and base URLs
api/subscription.go Updated Stripe billing portal URL to use GetProServerURL()
api/user.go Updated OAuth and streaming URLs to use GetBaseURL()
config/fetcher.go Updated config endpoint URL to use GetBaseURL()
issue/issue.go Updated issue reporting URL to use GetBaseURL(); increased max log size
go.mod, go.sum Removed unused sing-dns dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jigar-f jigar-f requested a review from garmr-ulfr February 17, 2026 06:52
@jigar-f
Copy link
Contributor Author

jigar-f commented Feb 20, 2026

Pulling this in.

@jigar-f jigar-f merged commit 92dfeb6 into main Feb 20, 2026
2 checks passed
@jigar-f jigar-f deleted the jigar/stage-env branch February 20, 2026 07:07
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