Add validation to require API token when API is enabled

Co-authored-by: krau <71133316+krau@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-19 05:49:12 +00:00
parent 173a5e3733
commit 3a6402a71b

View File

@@ -19,6 +19,11 @@ func Init(ctx context.Context) error {
return nil
}
// Validate that token is configured when API is enabled
if cfg.API.Token == "" {
return fmt.Errorf("API is enabled but token is not configured. Please set 'api.token' in your configuration file for security")
}
logger := log.FromContext(ctx).WithPrefix("api")
mux := http.NewServeMux()