dev: set timeout for loading JSON schema (#4605)
This commit is contained in:
parent
3785a3b951
commit
1ff07c1560
@ -3,14 +3,16 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
hcversion "github.com/hashicorp/go-version"
|
hcversion "github.com/hashicorp/go-version"
|
||||||
"github.com/pelletier/go-toml/v2"
|
"github.com/pelletier/go-toml/v2"
|
||||||
"github.com/santhosh-tekuri/jsonschema/v5"
|
"github.com/santhosh-tekuri/jsonschema/v5"
|
||||||
_ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
|
"github.com/santhosh-tekuri/jsonschema/v5/httploader"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@ -98,6 +100,8 @@ func createSchemaURL(flags *pflag.FlagSet, buildInfo BuildInfo) (string, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func validateConfiguration(schemaPath, targetFile string) error {
|
func validateConfiguration(schemaPath, targetFile string) error {
|
||||||
|
httploader.Client = &http.Client{Timeout: 2 * time.Second}
|
||||||
|
|
||||||
compiler := jsonschema.NewCompiler()
|
compiler := jsonschema.NewCompiler()
|
||||||
compiler.Draft = jsonschema.Draft7
|
compiler.Draft = jsonschema.Draft7
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user