mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-12-21 23:52:29 +00:00
fix: review comments
This commit is contained in:
@@ -41,7 +41,9 @@ func healthcheckCmd() *cli.Command {
|
|||||||
|
|
||||||
log.Info().Str("app_url", appUrl).Msg("Performing health check")
|
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)
|
req, err := http.NewRequest("GET", appUrl+"/api/healthz", nil)
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ func verifyUserCmd() *cli.Command {
|
|||||||
ok := totp.Validate(tCfg.Totp, user.TotpSecret)
|
ok := totp.Validate(tCfg.Totp, user.TotpSecret)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("TOTP code incorrect: %w", err)
|
return fmt.Errorf("TOTP code incorrect")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info().Msg("User verified")
|
log.Info().Msg("User verified")
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ func (app *BootstrapApp) heartbeat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client := &http.Client{
|
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"
|
heartbeatURL := config.ApiServer + "/v1/instances/heartbeat"
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ type AuthConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OAuthConfig struct {
|
type OAuthConfig struct {
|
||||||
Whitelist string `description:"Comma-separated list of allowed OAuth domains." yaml:"whitelist"`
|
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"`
|
AutoRedirect string `description:"The OAuth provider to use for automatic redirection." yaml:"autoRedirect"`
|
||||||
Providers map[string]OAuthServiceConfig
|
Providers map[string]OAuthServiceConfig `description:"OAuth providers configuration." yaml:"providers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UIConfig struct {
|
type UIConfig struct {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ func (generic *GenericOAuthService) Init() error {
|
|||||||
|
|
||||||
httpClient := &http.Client{
|
httpClient := &http.Client{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ func NewGithubOAuthService(config config.OAuthServiceConfig) *GithubOAuthService
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (github *GithubOAuthService) Init() error {
|
func (github *GithubOAuthService) Init() error {
|
||||||
httpClient := &http.Client{}
|
httpClient := &http.Client{
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
|
}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient)
|
ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient)
|
||||||
github.context = ctx
|
github.context = ctx
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ func NewGoogleOAuthService(config config.OAuthServiceConfig) *GoogleOAuthService
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (google *GoogleOAuthService) Init() error {
|
func (google *GoogleOAuthService) Init() error {
|
||||||
httpClient := &http.Client{}
|
httpClient := &http.Client{
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
|
}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient)
|
ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient)
|
||||||
google.context = ctx
|
google.context = ctx
|
||||||
|
|||||||
Reference in New Issue
Block a user