Skip to content

Commit 1ff07c1

Browse files
authored
dev: set timeout for loading JSON schema (#4605)
1 parent 3785a3b commit 1ff07c1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/commands/config_verify.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ package commands
33
import (
44
"errors"
55
"fmt"
6+
"net/http"
67
"os"
78
"path/filepath"
89
"strings"
10+
"time"
911

1012
hcversion "github.com/hashicorp/go-version"
1113
"github.com/pelletier/go-toml/v2"
1214
"github.com/santhosh-tekuri/jsonschema/v5"
13-
_ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
15+
"github.com/santhosh-tekuri/jsonschema/v5/httploader"
1416
"github.com/spf13/cobra"
1517
"github.com/spf13/pflag"
1618
"gopkg.in/yaml.v3"
@@ -98,6 +100,8 @@ func createSchemaURL(flags *pflag.FlagSet, buildInfo BuildInfo) (string, error)
98100
}
99101

100102
func validateConfiguration(schemaPath, targetFile string) error {
103+
httploader.Client = &http.Client{Timeout: 2 * time.Second}
104+
101105
compiler := jsonschema.NewCompiler()
102106
compiler.Draft = jsonschema.Draft7
103107

0 commit comments

Comments
 (0)