MCPcopy Index your code
hub / github.com/rilldata/rill / ResolveVariables

Method ResolveVariables

admin/projects.go:545–558  ·  view source on GitHub ↗

ResolveVariables resolves the project's variables for the given environment. It fetches the variable specific to the environment plus the default variables not set exclusively for the environment. The returned list is sorted by environment name for consistent ordering, with default variables (empty

(ctx context.Context, depl *database.Deployment)

Source from the content-addressed store, hash-verified

543// It fetches the variable specific to the environment plus the default variables not set exclusively for the environment.
544// The returned list is sorted by environment name for consistent ordering, with default variables (empty environment) first.
545func (s *Service) ResolveVariables(ctx context.Context, depl *database.Deployment) ([]*database.ProjectVariable, map[string]string, error) {
546 vars, err := s.DB.FindProjectVariables(ctx, depl.ProjectID, &depl.Environment)
547 if err != nil {
548 return nil, nil, err
549 }
550 slices.SortFunc(vars, func(a, b *database.ProjectVariable) int {
551 return strings.Compare(a.Environment, b.Environment)
552 })
553 // Enable the file watcher for editable deployments.
554 systemVars := map[string]string{
555 "rill.watch_repo": strconv.FormatBool(depl.Editable),
556 }
557 return vars, systemVars, nil
558}

Callers 2

StartDeploymentInnerMethod · 0.95
GetDeploymentConfigMethod · 0.45

Calls 1

FindProjectVariablesMethod · 0.65

Tested by

no test coverage detected