parse

package
v0.19.1164 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFilename error = fmt.Errorf("invalid filename")

Functions

func AppNameFromDirName

func AppNameFromDirName(dir string) (string, error)

func AppNameFromFilename

func AppNameFromFilename(file string) (string, error)

func FilenameFromAppName

func FilenameFromAppName(appName string) string

func Parse

func Parse(parseCfg ParseConfig) (*config.AppConfig, error)

func ParseAppBranchConfig added in v0.19.1164

func ParseAppBranchConfig(r io.Reader) (*config.AppBranchConfig, error)

ParseAppBranchConfig reads a single standalone app branch config from a TOML document. Unlike the app config directory parser, the document is the branch itself rather than a `[branch]` section of a larger config.

func ParseAppBranchConfigFile added in v0.19.1164

func ParseAppBranchConfigFile(path string) (*config.AppBranchConfig, error)

ParseAppBranchConfigFile parses one branch config file.

func ParseDir

func ParseDir(ctx context.Context, parseCfg ParseConfig) (*config.AppConfig, error)

func ParseInstallConfig added in v0.19.1091

func ParseInstallConfig(r io.Reader, v *validator.Validate) (*config.Install, error)

func ReadFile

func ReadFile(filename string) ([]byte, error)

func Template

func Template(byts []byte) ([]byte, error)

Types

type AppBranchConfigFile added in v0.19.1164

type AppBranchConfigFile struct {
	Path   string
	Config *config.AppBranchConfig
}

AppBranchConfigFile pairs a parsed branch config with the file it came from, so callers can point at the offending file when two files declare the same branch name.

func LoadAppBranchConfigs added in v0.19.1164

func LoadAppBranchConfigs(path string) ([]AppBranchConfigFile, bool, error)

LoadAppBranchConfigs loads a single TOML file or a directory of them.

func ParseAppBranchConfigDir added in v0.19.1164

func ParseAppBranchConfigDir(dir string) ([]AppBranchConfigFile, error)

ParseAppBranchConfigDir recursively parses every *.toml file under dir. Files are visited in sorted path order so the resulting plan is deterministic, and two files declaring the same branch name are rejected.

type BaseConfig

type BaseConfig struct {
	ConfigVars map[string]interface{} `toml:"config_vars"`
}

type ConfigDir

type ConfigDir struct {
	Branch         *config.AppBranchConfig   `name:"branch"`
	Branches       []*config.AppBranchConfig `name:"branches"`
	Components     []*config.Component       `name:"components"`
	Actions        []*config.ActionConfig    `name:"actions"`
	Runbooks       []*config.RunbookConfig   `name:"runbooks"`
	Installs       []*config.Install         `name:"installs"`
	InstallsConfig *config.InstallsConfig    `name:"installs"`
	Triggers       *config.TriggersConfig    `name:"triggers"`

	Policies    *config.PoliciesConfig `name:"policies"`
	PoliciesDir []config.AppPolicy     `name:"policies"`

	Secrets    *config.SecretsConfig `name:"secrets"`
	SecretsDir []*config.AppSecret   `name:"secrets"`

	Inputs         *config.AppInputConfig `name:"inputs"`
	InputsDir      []config.AppInput      `name:"inputs"`
	InputGroupsDir []config.AppInputGroup `name:"input_groups"`

	Permissions    *config.PermissionsConfig `name:"permissions"`
	PermissionsDir []*config.AppAWSIAMRole   `name:"permissions"`

	OperationRolesConfig *config.OperationRolesConfig `name:"operation_roles"`

	KubernetesContexts    *config.KubernetesContextsConfig `name:"kubernetes_contexts"`
	KubernetesContextsDir []*config.KubernetesContext      `name:"kubernetes_contexts"`

	BreakGlass    *config.BreakGlass      `name:"break_glass"`
	BreakGlassDir []*config.AppAWSIAMRole `name:"break_glass"`

	Stack     *config.StackConfig      `name:"stack"`
	Sandbox   *config.AppSandboxConfig `name:"sandbox"`
	Runner    *config.AppRunnerConfig  `name:"runner"`
	Metadata  *config.MetadataConfig   `name:"metadata,required"`
	Installer *config.InstallerConfig  `name:"installer"`
}

NOTE(jm): this is only required as a temporary migration path, while the old config syncing exists.

This will be removed and we will pass the `config.AppConfig` into the directory parser once we have time to remove the old version.

type File

type File struct {
	AppName string
	Path    string
}

func FindConfigFiles

func FindConfigFiles(rootDir string) ([]File, error)

type FileProcessor

type FileProcessor func(string, map[string]any) map[string]any

FileProcessor is a function to process config files before they're marshalled into a config struct and synced to the api.

type ParseConfig

type ParseConfig struct {
	Filename string
	Dirname  string

	Bytes []byte

	BackendType   config.BackendType
	V             *validator.Validate
	Template      bool
	FileProcessor func(name string, obj map[string]any) map[string]any
}

type ParseErr

type ParseErr struct {
	Filename    string
	Description string
	Err         error
}

func (ParseErr) Error

func (p ParseErr) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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