Skip to content

Commit

Permalink
decode known yaml fields
Browse files Browse the repository at this point in the history
  • Loading branch information
briangregoryholmes committed Dec 9, 2024
1 parent 35ed1ab commit 2b666e6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions runtime/compilers/rillv1/parse_rillyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"strings"

"github.com/rilldata/rill/runtime/pkg/env"
"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -40,6 +41,7 @@ type VariableDef struct {

// rillYAML is the raw YAML structure of rill.yaml
type rillYAML struct {
Compiler string `yaml:"compiler"`
// Title of the project
DisplayName string `yaml:"display_name"`
// Title of the project
Expand Down Expand Up @@ -92,10 +94,18 @@ func (p *Parser) parseRillYAML(ctx context.Context, path string) error {
}

tmp := &rillYAML{}

if err := yaml.Unmarshal([]byte(data), tmp); err != nil {
return newYAMLError(err)
}

dec := yaml.NewDecoder(strings.NewReader(data))
dec.KnownFields(true)
err = dec.Decode(tmp)
if err != nil {
return newYAMLError(err)
}

// Look for environment-specific overrides
for k, v := range tmp.Env { // nolint: gocritic // Using a pointer changes parser behavior
if v.Kind == yaml.ScalarNode {
Expand Down

0 comments on commit 2b666e6

Please sign in to comment.