[PR #1215] [MERGED] Add scheme option to bind to both HTTP and HTTPS #1297

Closed
opened 2026-03-03 12:33:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/1215
Author: @raz-amir
Created: 6/15/2023
Status: Merged
Merged: 8/1/2023
Merged by: @fsouza

Base: mainHead: ramir_both_schemes


📝 Commits (8)

  • 0e467a4 Add scheme option to bind to both HTTP and HTTPS
  • ea0ba66 changes
  • b053e10 Change to 2 listeners and a single server
  • d708fee fix
  • 46a6906 Apply suggestions from code review
  • 9cffba9 fix for default ports handling
  • 8614c04 check if flags default value using visit
  • da920f7 add example test runs and unit tests

📊 Changes

7 files changed (+375 additions, -51 deletions)

View changed files

📝 .github/workflows/main.yml (+6 -0)
📝 README.md (+23 -12)
ci/run-curl-both-scheme-default-ports-example.sh (+11 -0)
ci/run-curl-both-scheme-non-default-ports-example.sh (+11 -0)
📝 internal/config/config.go (+50 -8)
📝 internal/config/config_test.go (+215 -3)
📝 main.go (+59 -28)

📄 Description

We have a use case where we need the same server to run in both HTTP and HTTPS.
This PR starts two servers when needed (the default single HTTPS server is kept).
It is controlled by adding/changing the following command line arguments:

  1. Existing scheme argument can now get the value both
  2. New port-http argument, defaults to 8080, is used to bind HTTP port only when scheme is set to both. To clarify: to maintain backwards compatibility, when the scheme is set to http, this argument isn't used. The previous port will be used to bind HTTPS.

Added/updated tests
Updated README


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fsouza/fake-gcs-server/pull/1215 **Author:** [@raz-amir](https://github.com/raz-amir) **Created:** 6/15/2023 **Status:** ✅ Merged **Merged:** 8/1/2023 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `ramir_both_schemes` --- ### 📝 Commits (8) - [`0e467a4`](https://github.com/fsouza/fake-gcs-server/commit/0e467a4047a2010858eb201e4531e2848c77893a) Add scheme option to bind to both HTTP and HTTPS - [`ea0ba66`](https://github.com/fsouza/fake-gcs-server/commit/ea0ba662c5381c1317c13151f231e361cb7e51e9) changes - [`b053e10`](https://github.com/fsouza/fake-gcs-server/commit/b053e10e2a8ebc7ee589a82598f0188936cce125) Change to 2 listeners and a single server - [`d708fee`](https://github.com/fsouza/fake-gcs-server/commit/d708fee0c0141f385fa1bc2d5f12b3a419b86f12) fix - [`46a6906`](https://github.com/fsouza/fake-gcs-server/commit/46a6906dcb550f72fd5d8fc3bec13ca96662eb7b) Apply suggestions from code review - [`9cffba9`](https://github.com/fsouza/fake-gcs-server/commit/9cffba94198f71508d8b194f50e08de6c217df92) fix for default ports handling - [`8614c04`](https://github.com/fsouza/fake-gcs-server/commit/8614c048c3871573dd9474a9769745579f54293a) check if flags default value using visit - [`da920f7`](https://github.com/fsouza/fake-gcs-server/commit/da920f7c3467d42fa59a60f09c6e754da88b7676) add example test runs and unit tests ### 📊 Changes **7 files changed** (+375 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/main.yml` (+6 -0) 📝 `README.md` (+23 -12) ➕ `ci/run-curl-both-scheme-default-ports-example.sh` (+11 -0) ➕ `ci/run-curl-both-scheme-non-default-ports-example.sh` (+11 -0) 📝 `internal/config/config.go` (+50 -8) 📝 `internal/config/config_test.go` (+215 -3) 📝 `main.go` (+59 -28) </details> ### 📄 Description We have a use case where we need the same server to run in both HTTP and HTTPS. This PR starts two servers when needed (the default single HTTPS server is kept). It is controlled by adding/changing the following command line arguments: 1. Existing `scheme` argument can now get the value `both` 2. New `port-http` argument, defaults to `8080`, is used to bind HTTP port only when `scheme` is set to `both`. To clarify: to maintain backwards compatibility, when the `scheme` is set to `http`, this argument isn't used. The previous `port` will be used to bind HTTPS. Added/updated tests Updated README --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:33:57 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#1297
No description provided.