-
-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Hi,
While setting up Sentinel for local development, I noticed that the API server always binds to:8888, regardless of whether the PORT environment variable is set.
This caused startup failures on my machine because port 8888 was already in use by another service.
Before opening a PR, I wanted to ask for confirmation:
Would it be acceptable to make the API bind address configurable via environment variables instead of hardcoding:8888?
Current behaviour:
The bind address is currently set in the default config as:
BindAddr: ":8888"
- Setting PORT has no effect
- Sentinel exits with bind: address already in use if 8888 is occupied
Why did this come up
Port 8888 is commonly used by:
- Local development servers
- Jupyter notebooks
- Other Go services
When running Sentinel locally (via go run or air), this can block startup and may be confusing for new contributors.
proposed solution
`func getBindAddr() string {
// Highest priority: full bind address
if addr := os.Getenv("BIND_ADDR"); addr != "" {
return addr
}
// Next: PORT only
if port := os.Getenv("PORT"); port != "" {
return ":" + port
}
// Default fallback
return ":8888"
}`
Question
Does this align with Sentinel’s intended design, or is the fixed port intentional for any reason?
If this change is acceptable, I’d be happy to open a PR.
Environment
- OS: Ubuntu Linux
- Go: 1.24+
- Running Sentinel locally with air