Skip to content

Conversation

@iuwqyir
Copy link
Contributor

@iuwqyir iuwqyir commented Oct 9, 2024

TL;DR

Added configurable API host for Swagger documentation and improved API configuration.

What changed?

  • Introduced a new APIConfig struct in configs/config.go with a Host field.
  • Added a new command-line flag --api-host in cmd/root.go with a default value of "localhost:3000".
  • Updated cmd/api.go to set the Swagger host dynamically using the configured API host.
  • Removed the hardcoded host from docs/docs.go, docs/swagger.json, and docs/swagger.yaml.

How to test?

  1. Run the API with a custom host:
    ./indexer api --api-host example.com:8080
    
  2. Check the Swagger documentation to ensure the host is set correctly.

Why make this change?

This change allows for greater flexibility in deploying the API to different environments. By making the API host configurable, it becomes easier to adapt the service to various deployment scenarios without modifying the code. This is particularly useful for staging, production, and custom deployment setups.

@iuwqyir iuwqyir changed the title make swagger doc host dynamic Add configurable API host and update Swagger documentation Oct 9, 2024
Copy link
Contributor Author

iuwqyir commented Oct 9, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @iuwqyir and the rest of your teammates on Graphite Graphite

@iuwqyir iuwqyir requested a review from catalyst17 October 9, 2024 13:19
@iuwqyir iuwqyir marked this pull request as ready for review October 9, 2024 13:19
@iuwqyir iuwqyir requested a review from AmineAfia October 9, 2024 13:32
Copy link
Contributor Author

iuwqyir commented Oct 9, 2024

Merge activity

  • Oct 9, 1:02 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Oct 9, 1:03 PM EDT: A user merged this pull request with Graphite.

@iuwqyir iuwqyir merged commit 4fe86e4 into main Oct 9, 2024
4 checks passed
@iuwqyir iuwqyir deleted the 10-09-make_swagger_doc_host_dynamic branch October 9, 2024 17:03
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.

3 participants