Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add configurable timeout cli flag #102

Merged
merged 2 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/helm-cm-push/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type (
keyring string
dependencyUpdate bool
out io.Writer
timeout int64
}

config struct {
Expand Down Expand Up @@ -125,6 +126,7 @@ func newPushCmd(args []string) *cobra.Command {
f.BoolVarP(&p.forceUpload, "force", "f", false, "Force upload even if chart version exists")
f.BoolVarP(&p.dependencyUpdate, "dependency-update", "d", false, `update dependencies from "requirements.yaml" to dir "charts/" before packaging`)
f.BoolVarP(&p.checkHelmVersion, "check-helm-version", "", false, `outputs either "2" or "3" indicating the current Helm major version`)
f.Int64VarP(&p.timeout, "timeout", "t", 30, "The duration (in seconds) Helm will wait to get response from chartmuseum")

f.Parse(args)

Expand Down Expand Up @@ -303,6 +305,7 @@ func (p *pushCmd) push() error {
cm.CertFile(p.certFile),
cm.KeyFile(p.keyFile),
cm.InsecureSkipVerify(p.insecureSkipVerify),
cm.Timeout(p.timeout),
)

if err != nil {
Expand Down
1 change: 0 additions & 1 deletion pkg/chartmuseum/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func (client *Client) Option(opts ...Option) *Client {
func NewClient(opts ...Option) (*Client, error) {
var client Client
client.Client = &http.Client{}
client.Option(Timeout(30))
client.Option(opts...)
client.Timeout = client.opts.timeout

Expand Down