fix: support REPOWISE_PORT env var in serve command#455
Merged
RaghavChamadiya merged 1 commit intoJun 12, 2026
Conversation
The serve_command click option for --port did not read the REPOWISE_PORT environment variable. Users who set REPOWISE_PORT in their .env file (as documented in .env.example) would find that the server always started on the default port 7337. Add envvar="REPOWISE_PORT" so click resolves the port from the environment when the --port flag is not given. Fixes repowise-dev#427
|
✅ Health: 7.7 (unchanged) 🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)
🔥 Hotspot touched (1)
🔗 Hidden coupling (1 file)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-06-11 13:10 UTC |
RaghavChamadiya
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #427 — Setting
REPOWISE_PORTin your.envfile (as documented in.env.example) has no effect. Therepowise servecommand always starts on the default port 7337 because the--portclick option doesn't read from theREPOWISE_PORTenvironment variable.Root Cause
At
/packages/cli/src/repowise/cli/commands/serve_cmd.py:481, the--portoption was defined as:@click.option("--port", default=7337, type=int, help="API server port.")Click supports reading from environment variables natively via
envvar=, but it wasn't wired up. So even whenREPOWISE_PORT=7000is set in.envand loaded byload_dotenv(), the option always used its hardcoded default of 7337.Fix
Added
envvar="REPOWISE_PORT"to the click option:@click.option("--port", default=7337, type=int, help="API server port.", envvar="REPOWISE_PORT")Now:
REPOWISE_PORTis read from the environment (set via.envor export)--portCLI flag still takes precedence over the env varTesting
REPOWISE_PORT=7000in.env, runrepowise serve→ API starts on 7000repowise serve --port 8000→ CLI flag overrides env varrepowise servewithout env var → starts on 7337If this fix helped, consider buying me a coffee! ☕
