envbuilder

package
v0.2.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDotenvFile added in v0.2.4

func DefaultDotenvFile() string

func Discover

func Discover(root string, maxDepth int) ([]string, error)

func DotenvFromPrompts added in v0.2.4

func DotenvFromPrompts(prompts []UserPrompt) string

func DotenvFromPromptsMerged added in v0.2.25

func DotenvFromPromptsMerged(prompts []UserPrompt, contents string) string

Types

type Chunk added in v0.2.25

type Chunk struct {
	Prompt      UserPrompt
	PromptIndex int
	Lines       string
	LineIndex   int
}

type DotenvChunks added in v0.2.25

type DotenvChunks []Chunk

func (DotenvChunks) Sort added in v0.2.25

func (ch DotenvChunks) Sort() DotenvChunks

Sort sorts by chunk position in dotenv file

func (DotenvChunks) String added in v0.2.25

func (ch DotenvChunks) String() string

type EnvironmentValidationError added in v0.2.3

type EnvironmentValidationError struct {
	Results []ValidationResult
}

EnvironmentValidationError contains the results of validating environment configuration.

func ValidateEnvironment added in v0.2.3

func ValidateEnvironment(repoRoot string, variables Variables) EnvironmentValidationError

ValidateEnvironment validates that all required environment variables are set according to UserPrompts and core DataRobot requirements. It checks both the provided envValues map (which should contain .env file values) and environment variables (which override .env values).

The validation process: 1. Determines which sections are active based on requires dependencies 2. Validates all required UserPrompts in active sections 3. Validates core DataRobot variables (DATAROBOT_ENDPOINT, DATAROBOT_API_TOKEN)

func (EnvironmentValidationError) Error added in v0.2.3

Error implements the error interface for EnvironmentValidationError.

func (EnvironmentValidationError) HasErrors added in v0.2.3

func (r EnvironmentValidationError) HasErrors() bool

HasErrors returns true if there are any validation errors.

type MissingPromptLineIndex added in v0.2.25

type MissingPromptLineIndex struct {
	LineIndex int
}

type MissingPrompts added in v0.2.25

type MissingPrompts map[string]MissingPromptLineIndex

type ParsedYaml

type ParsedYaml map[string][]UserPrompt

type PromptInstance added in v0.2.28

type PromptInstance struct {
	Prompt      UserPrompt
	PromptIndex int
	HelpLines   []string
}

type PromptInstances added in v0.2.28

type PromptInstances map[string]PromptInstance

type PromptOption

type PromptOption struct {
	Blank    bool
	Checked  bool
	Name     string `yaml:"name"`
	Value    string `yaml:"value,omitempty"`
	Requires string `yaml:"requires,omitempty"`
}

type PromptType added in v0.2.3

type PromptType string
const (
	PromptTypeString PromptType = "string"
	PromptTypeSecret PromptType = "secret_string"
)

func (PromptType) String added in v0.2.3

func (pt PromptType) String() string

type UserPrompt

type UserPrompt struct {
	Section   string
	Root      bool
	Active    bool
	Commented bool
	Value     string
	Hidden    bool

	Env      string         `yaml:"env"`
	Key      string         `yaml:"key"`
	Type     PromptType     `yaml:"type"`
	Multiple bool           `yaml:"multiple"`
	Options  []PromptOption `yaml:"options,omitempty"`
	Default  string         `yaml:"default,omitempty"`
	Help     string         `yaml:"help"`
	Optional bool           `yaml:"optional,omitempty"`
	Generate bool           `yaml:"generate,omitempty"`
}

func DetermineRequiredSections added in v0.2.3

func DetermineRequiredSections(userPrompts []UserPrompt) []UserPrompt

DetermineRequiredSections calculates which sections are required based on the requires dependencies in selected options.

func GatherUserPrompts

func GatherUserPrompts(rootDir string, variables Variables) ([]UserPrompt, error)

func (UserPrompt) HasEnvValue added in v0.2.3

func (up UserPrompt) HasEnvValue() bool

HasEnvValue returns true if prompt has effective value when written to .env file

func (UserPrompt) HelpLines added in v0.2.25

func (up UserPrompt) HelpLines() []string

func (UserPrompt) ShouldAsk added in v0.2.4

func (up UserPrompt) ShouldAsk() bool

func (UserPrompt) SkipSaving added in v0.2.3

func (up UserPrompt) SkipSaving() bool

func (UserPrompt) String added in v0.2.3

func (up UserPrompt) String() string

It will render as:

# The path to the VertexAI application credentials JSON file.
VERTEXAI_APPLICATION_CREDENTIALS=whatever-user-entered

func (UserPrompt) StringWithoutHelp added in v0.2.3

func (up UserPrompt) StringWithoutHelp() string

func (UserPrompt) Valid added in v0.2.3

func (up UserPrompt) Valid() bool

func (UserPrompt) VarName added in v0.2.3

func (up UserPrompt) VarName() string

type ValidationResult added in v0.2.3

type ValidationResult struct {
	Field   string // The environment variable name or key
	Value   string // The actual value (empty if not set)
	Valid   bool   // Whether the variable is valid
	Message string // Error message if invalid, or success message if valid
	Help    string // Optional help text describing the variable
}

ValidationResult represents the validation status of a single variable.

type Variable added in v0.2.3

type Variable struct {
	Name        string
	Value       string
	Description string
	Secret      bool
	Commented   bool
}

Variable represents a parsed environment variable from a .env file or template.

func NewFromLine added in v0.2.3

func NewFromLine(line string, unquotedValues map[string]string) Variable

func ParseVariablesOnly added in v0.2.3

func ParseVariablesOnly(dotenvLines []string) []Variable

ParseVariablesOnly parses variables from lines without attempting to auto-populate them. This is used when parsing .env files to extract variable names and values. Commented lines (starting with #) are marked as such.

func VariablesFromLines added in v0.2.4

func VariablesFromLines(lines []string) ([]Variable, string)

func (*Variable) String added in v0.2.3

func (v *Variable) String() string

func (*Variable) StringSecret added in v0.2.13

func (v *Variable) StringSecret() string

type Variables added in v0.2.3

type Variables []Variable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL