Skip to content

Commit

Permalink
chore(cli): disable strict provider json parsing for calls from the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbreuninger committed Jun 5, 2023
1 parent eec3210 commit 27a51a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/provider/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import (
"encoding/json"
"fmt"
"io"
"os"
"regexp"
"strconv"
"strings"
"time"

"github.com/blang/semver"
"github.com/ghodss/yaml"
"github.com/loft-sh/devpod/pkg/telemetry"
"github.com/pkg/errors"
)

Expand All @@ -38,7 +40,11 @@ func ParseProvider(reader io.Reader) (*ProviderConfig, error) {
}

decoder := json.NewDecoder(bytes.NewReader(jsonBytes))
decoder.DisallowUnknownFields()

// Disallow unknown fields in standalone version but allow them in the UI unti we have a versioning strategy
if os.Getenv(telemetry.UIEnvVar) != "true" {
decoder.DisallowUnknownFields()
}

parsedConfig := &ProviderConfig{}
err = decoder.Decode(parsedConfig)
Expand Down

0 comments on commit 27a51a9

Please sign in to comment.