You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments