diff --git a/cmd/healthcheck.go b/cmd/healthcheck.go index 837b373..4980548 100644 --- a/cmd/healthcheck.go +++ b/cmd/healthcheck.go @@ -41,7 +41,9 @@ func healthcheckCmd() *cli.Command { log.Info().Str("app_url", appUrl).Msg("Performing health check") - client := http.Client{} + client := http.Client{ + Timeout: 30 * time.Second, + } req, err := http.NewRequest("GET", appUrl+"/api/healthz", nil) diff --git a/cmd/verify.go b/cmd/verify.go index 222f467..ddb114e 100644 --- a/cmd/verify.go +++ b/cmd/verify.go @@ -109,7 +109,7 @@ func verifyUserCmd() *cli.Command { ok := totp.Validate(tCfg.Totp, user.TotpSecret) if !ok { - return fmt.Errorf("TOTP code incorrect: %w", err) + return fmt.Errorf("TOTP code incorrect") } log.Info().Msg("User verified") diff --git a/internal/bootstrap/app_bootstrap.go b/internal/bootstrap/app_bootstrap.go index 400dd1a..a4d8024 100644 --- a/internal/bootstrap/app_bootstrap.go +++ b/internal/bootstrap/app_bootstrap.go @@ -214,7 +214,7 @@ func (app *BootstrapApp) heartbeat() { } client := &http.Client{ - Timeout: time.Duration(10) * time.Second, // The server should never take more than 10 seconds to respond + Timeout: 30 * time.Second, // The server should never take more than 30 seconds to respond } heartbeatURL := config.ApiServer + "/v1/instances/heartbeat" diff --git a/internal/config/config.go b/internal/config/config.go index f4bb484..e664c4d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -48,9 +48,9 @@ type AuthConfig struct { } type OAuthConfig struct { - Whitelist string `description:"Comma-separated list of allowed OAuth domains." yaml:"whitelist"` - AutoRedirect string `description:"The OAuth provider to use for automatic redirection." yaml:"autoRedirect"` - Providers map[string]OAuthServiceConfig + Whitelist string `description:"Comma-separated list of allowed OAuth domains." yaml:"whitelist"` + AutoRedirect string `description:"The OAuth provider to use for automatic redirection." yaml:"autoRedirect"` + Providers map[string]OAuthServiceConfig `description:"OAuth providers configuration." yaml:"providers"` } type UIConfig struct { diff --git a/internal/service/generic_oauth_service.go b/internal/service/generic_oauth_service.go index 22d79bf..d68f8ae 100644 --- a/internal/service/generic_oauth_service.go +++ b/internal/service/generic_oauth_service.go @@ -54,6 +54,7 @@ func (generic *GenericOAuthService) Init() error { httpClient := &http.Client{ Transport: transport, + Timeout: 30 * time.Second, } ctx := context.Background() diff --git a/internal/service/github_oauth_service.go b/internal/service/github_oauth_service.go index 0d3d76f..11dcf61 100644 --- a/internal/service/github_oauth_service.go +++ b/internal/service/github_oauth_service.go @@ -50,7 +50,9 @@ func NewGithubOAuthService(config config.OAuthServiceConfig) *GithubOAuthService } func (github *GithubOAuthService) Init() error { - httpClient := &http.Client{} + httpClient := &http.Client{ + Timeout: 30 * time.Second, + } ctx := context.Background() ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient) github.context = ctx diff --git a/internal/service/google_oauth_service.go b/internal/service/google_oauth_service.go index 474c285..0ece6f2 100644 --- a/internal/service/google_oauth_service.go +++ b/internal/service/google_oauth_service.go @@ -45,7 +45,9 @@ func NewGoogleOAuthService(config config.OAuthServiceConfig) *GoogleOAuthService } func (google *GoogleOAuthService) Init() error { - httpClient := &http.Client{} + httpClient := &http.Client{ + Timeout: 30 * time.Second, + } ctx := context.Background() ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient) google.context = ctx