Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow setting of the port number when using the --serve flag by adding a new --port (String) flag #1557

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

Riddhimaan-Senapati
Copy link
Contributor

@Riddhimaan-Senapati Riddhimaan-Senapati commented Jan 31, 2025

changes are in file osv-scanner/cmd/osv-scanner/internal/helper/helper.go

1.Added a global variable servePort with a default value of "8000"

2.Added a new CLI flag --port that allows users to customize the port number used when serving the HTML report

3.Removed the hardcoded port number from the ServeHTML function, using the global servePort variable instead

  1. The flag's Action function updates the global servePort variable when a custom port is specified

These changes allow users to specify a custom port using the --port flag when using the --serve option, while maintaining the default port 8000 if no custom port is specified.

Verified

This commit was signed with the committer’s verified signature.
AleksandrHovhannisyan Aleksandr Hovhannisyan
1.Added a global variable servePort with a default value of "8000"

2.Added a new CLI flag --port that allows users to customize the port number used when serving the HTML report

3. Removed the hardcoded port number from the ServeHTML function, using the global servePort variable instead

4. The flag's Action function updates the global servePort variable when a custom port is specified

These changes allow users to specify a custom port using the --port flag when using the --serve option, while maintaining the default port 8000 if no custom port is specified.
…xed_issue_#1555

fixed issue google#1555
Copy link

google-cla bot commented Jan 31, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Riddhimaan-Senapati
Copy link
Contributor Author

Riddhimaan-Senapati commented Jan 31, 2025

@jtt @abhisek @calebbrown @iurisilvio Can anyone of you review my PR? I have also just signed the Google CLA. Excited to begin contributing to this repository.

@hogo6002
Copy link
Contributor

hogo6002 commented Feb 3, 2025

Hi @Riddhimaan-Senapati thanks for contributing! I like having a separate string flag to specify the port number instead of converting serve from a bool flag into a string flag.

Can you follow https://github.com/google/osv-scanner/pull/1557/checks?check_run_id=36491080803 and Github commit name convention to resolve failed tasks

@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 69.30%. Comparing base (a5d0e2b) to head (cccacb7).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/osv-scanner/internal/helper/helper.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1557      +/-   ##
==========================================
- Coverage   69.31%   69.30%   -0.02%     
==========================================
  Files         200      200              
  Lines       19038    19041       +3     
==========================================
  Hits        13196    13196              
- Misses       5135     5138       +3     
  Partials      707      707              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Riddhimaan-Senapati Riddhimaan-Senapati changed the title Fixed Issue #1555 feat: Allow setting of the port number when using the --serve flag by adding a new --port (String) flag Feb 3, 2025
feature: add a new string flag to help the user specify a server port instead of just using a hard coded value
@Riddhimaan-Senapati
Copy link
Contributor Author

@hogo6002 Done, I have changed the PR title and fixed some linting issues in the code and created an appropriately named commit for that.

Copy link
Collaborator

@another-rex another-rex left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@hogo6002 hogo6002 merged commit dd9918b into google:main Feb 3, 2025
13 checks passed
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.

None yet

4 participants