-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configurable API host and update Swagger documentation (#96)
### 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.
- Loading branch information
Showing
6 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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