varparser

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package varparser contains the logic for parsing HCL and environment variables that Phobos API supports. It supports parsing variables passed in via flags and from files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParseEnvironmentVariablesInput

type ParseEnvironmentVariablesInput struct {
	EnvVarFilePaths []string
	EnvVariables    []string
}

ParseEnvironmentVariablesInput defines the input for ProcessEnvironmentVariables.

type ParseHCLVariablesInput

type ParseHCLVariablesInput struct {
	HCLVarFilePaths []string
	HCLVariables    []string
}

ParseHCLVariablesInput defines the input for ProcessHCLVariables.

type Variable

type Variable struct {
	Value    string
	Key      string
	Category pb.VariableCategory
}

Variable represents a parsed HCL or environment variable.

type VariableParser

type VariableParser struct {
	// contains filtered or unexported fields
}

VariableParser implements functionalities needed to parse variables.

func NewVariableParser

func NewVariableParser(configDirectory *string, withHCLVarsFromEnvironment bool) *VariableParser

NewVariableParser returns a new VariableProcessor.

func (*VariableParser) ParseEnvironmentVariables

func (v *VariableParser) ParseEnvironmentVariables(input *ParseEnvironmentVariablesInput) ([]Variable, error)

ParseEnvironmentVariables dispatches functions to parse environment variables and returns a unique slice of parsed Variables.

Parsing precedence: 1. --env-var-file option(s). 2. --env-var option(s).

func (*VariableParser) ParseHCLVariables

func (v *VariableParser) ParseHCLVariables(input *ParseHCLVariablesInput) ([]Variable, error)

ParseHCLVariables dispatches the functions to parse HCL variables and returns a unique slice of parsed Variables.

Parsing precedence: 1. HCL variables from the environment. 2. phobos.pbvars file, if present. 3. phobos.pbvars.json file, if present. 4. *.auto.pbvars.* files, if present. 5. --pb-var-file option(s). 6. --pb-var option(s).

Jump to

Keyboard shortcuts

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