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.
Related Issue
Fixes #56
Description of Changes
This PR implements proper port configuration handling across the Preswald application ensuring consistent behavior between CLI arguments, configuration files, and default values.
In main.py file
=> Added proper port priority logic in start_server function
=> Implemented environment variable setting for frontend communication
=> Added clear logging messages for port configuration
=> fixed linter errors
In vite.config.js in frontend
=> Updated proxy configuration to use environment variable
=> Added fallback to default port
=> Made proxy configuration more robust with changeOrigin
In cli.py file
=> Updated help text to accurately describe port configuration behavior
=> Added clear documentation about port priority
=> Improved command descriptions
Port Priority Implementation
The changes establish a clear port priority order:
Tested Locally CLI:
=> Installed pytest and pytest-mock
=> Created a test_port_config.py file
=> test_port_priority_cli_argument: Verifies that CLI argument (--port) takes highest precedence
=> test_port_priority_config_file: Verifies that config file port is used when no CLI override
=> test_port_priority_default: Verifies fallback to default port (8501)
=> test_invalid_config_file: Verifies graceful handling of invalid config files
Type of Change
Testing

Checklist