Documentation
¶
Index ¶
- func DefaultDotenvFile() string
- func Discover(root string, maxDepth int) ([]string, error)
- func DotenvFromPrompts(prompts []UserPrompt) string
- func DotenvFromPromptsMerged(prompts []UserPrompt, contents string) string
- type Chunk
- type DotenvChunks
- type EnvironmentValidationError
- type MissingPromptLineIndex
- type MissingPrompts
- type ParsedYaml
- type PromptInstance
- type PromptInstances
- type PromptOption
- type PromptType
- type UserPrompt
- func (up UserPrompt) HasEnvValue() bool
- func (up UserPrompt) HelpLines() []string
- func (up UserPrompt) ShouldAsk() bool
- func (up UserPrompt) SkipSaving() bool
- func (up UserPrompt) String() string
- func (up UserPrompt) StringWithoutHelp() string
- func (up UserPrompt) Valid() bool
- func (up UserPrompt) VarName() string
- type ValidationResult
- type Variable
- type Variables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDotenvFile ¶ added in v0.2.4
func DefaultDotenvFile() string
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
func (r EnvironmentValidationError) Error() string
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 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
Variable represents a parsed environment variable from a .env file or template.
func NewFromLine ¶ added in v0.2.3
func ParseVariablesOnly ¶ added in v0.2.3
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.