Skip to content

Commit

Permalink
feat(api): config to set timeout and tls config (#5270)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsamin authored Jun 19, 2020
1 parent 11d37a6 commit a0a0966
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions engine/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ type Configuration struct {
Directories struct {
Download string `toml:"download" default:"/var/lib/cds-engine" json:"download"`
} `toml:"directories" json:"directories"`
InternalServiceMesh struct {
RequestSecondsTimeout int `toml:"requestSecondsTimeout" json:"requestSecondsTimeout" default:"60"`
InsecureSkipVerifyTLS bool `toml:"insecureSkipVerifyTLS" json:"insecureSkipVerifyTLS" default:"false"`
} `toml:"internalServiceMesh" json:"internalServiceMesh"`
Auth struct {
DefaultGroup string `toml:"defaultGroup" default:"" comment:"The default group is the group in which every new user will be granted at signup" json:"defaultGroup"`
RSAPrivateKey string `toml:"rsaPrivateKey" default:"" comment:"The RSA Private Key used to sign and verify the JWT Tokens issued by the API \nThis is mandatory." json:"-"`
Expand Down Expand Up @@ -404,6 +408,15 @@ func (a *API) Serve(ctx context.Context) error {
return sdk.WrapError(err, "unable to initialize the JWT Layer")
}

// Intialize service mesh httpclient
if a.Config.InternalServiceMesh.RequestSecondsTimeout == 0 {
a.Config.InternalServiceMesh.RequestSecondsTimeout = 60
}
services.HTTPClient = cdsclient.NewHTTPClient(
time.Duration(a.Config.InternalServiceMesh.RequestSecondsTimeout)*time.Second,
a.Config.InternalServiceMesh.InsecureSkipVerifyTLS,
)

// Initialize mail package
log.Info(ctx, "Initializing mail driver...")
mail.Init(a.Config.SMTP.User,
Expand Down

0 comments on commit a0a0966

Please sign in to comment.