mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-08-06 21:13:27 +08:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user