config

package
v0.0.0-...-13c9884 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSchema

func GenerateSchema(ctx context.Context, filename string, pr *plugins.PluginRepository) (string, error)

func LoadRefData

func LoadRefData(_ context.Context, node *yaml.Node, cwd string) (*yaml.Node, string, error)

LoadRefData will load referenced files and replace the node with the content of these files. It works both with the ${include()} syntax and the $ref syntax.

Types

type ComponentConfig

type ComponentConfig struct {
	Name         string            `yaml:"name"`
	Source       Source            `yaml:"source"`
	Paths        []string          `yaml:"paths"`
	Version      string            `yaml:"version"`
	Branch       string            `yaml:"branch"`
	Integrations []string          `yaml:"integrations"`
	Endpoints    map[string]string `yaml:"endpoints"`
}

type ConfigOptions

type ConfigOptions struct {
	VarFilenames []string
	Plugins      *plugins.PluginRepository

	Validate bool

	NoResolveVars bool
}

type Deployment

type Deployment struct {
	Type DeploymentType `yaml:"type" default:"site"`
}

type DeploymentType

type DeploymentType string
const (
	DeploymentSite          DeploymentType = "site"
	DeploymentSiteComponent DeploymentType = "site-component"
)

type FileSource

type FileSource struct {
	Filename  string
	Encrypted bool
}

type GlobalConfig

type GlobalConfig struct {
	Environment            string           `yaml:"environment"`
	Cloud                  string           `yaml:"cloud"`
	TerraformStateProvider string           `yaml:"-"`
	TerraformConfig        *TerraformConfig `yaml:"terraform_config"`
}

type MachComposer

type MachComposer struct {
	Version       any                         `yaml:"version"`
	VariablesFile string                      `yaml:"variables_file"`
	Plugins       map[string]MachPluginConfig `yaml:"plugins"`
	Cloud         MachComposerCloud           `yaml:"cloud"`
	Deployment    Deployment                  `yaml:"deployment"`
}

func (*MachComposer) CloudEnabled

func (mc *MachComposer) CloudEnabled() bool

type MachComposerCloud

type MachComposerCloud struct {
	Organization string `yaml:"organization"`
	Project      string `yaml:"project"`

	Client *mccsdk.APIClient
}

func (*MachComposerCloud) Empty

func (mcc *MachComposerCloud) Empty() bool

type MachConfig

type MachConfig struct {
	Filename     string            `yaml:"-"`
	MachComposer MachComposer      `yaml:"mach_composer"`
	Global       GlobalConfig      `yaml:"global"`
	Sites        SiteConfigs       `yaml:"sites"`
	Components   []ComponentConfig `yaml:"components"`

	StateRepository *state.Repository

	Plugins     *plugins.PluginRepository `yaml:"-"`
	Variables   *Variables                `yaml:"-"`
	IsEncrypted bool                      `yaml:"-"`
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, filename string, opts *ConfigOptions) (*MachConfig, error)

Open is the main entrypoint for this module. It opens the given yaml filename and reads it to construct the MachConfig. Note that you need to close the MachConfig via the Close() method in order to clean up.

func (*MachConfig) Close

func (c *MachConfig) Close()

func (*MachConfig) HasSite

func (c *MachConfig) HasSite(ident string) bool

type MachPluginConfig

type MachPluginConfig struct {
	Source  string `yaml:"source"`
	Version string `yaml:"version"`
	Replace string `yaml:"replace"`
}

type NotFoundError

type NotFoundError struct {
	Name string
	Node *yaml.Node
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type SiteComponentConfig

type SiteComponentConfig struct {
	Name       string                `yaml:"name"`
	Definition *ComponentConfig      `yaml:"-"`
	Variables  variable.VariablesMap `yaml:"variables"`
	Secrets    variable.VariablesMap `yaml:"secrets"`
	Deployment *Deployment           `yaml:"deployment"`

	DependsOn []string `yaml:"depends_on"`
}

func (*SiteComponentConfig) HasCloudIntegration

func (sc *SiteComponentConfig) HasCloudIntegration(g *GlobalConfig) bool

type SiteComponentConfigs

type SiteComponentConfigs []SiteComponentConfig

func (*SiteComponentConfigs) Get

type SiteConfig

type SiteConfig struct {
	Name         string         `yaml:"name"`
	Identifier   string         `yaml:"identifier"`
	Deployment   *Deployment    `yaml:"deployment"`
	RawEndpoints map[string]any `yaml:"endpoints"`

	Components SiteComponentConfigs `yaml:"components"`
}

SiteConfig contains all configuration needed for a site.

type SiteConfigs

type SiteConfigs []SiteConfig

func (*SiteConfigs) Get

func (s *SiteConfigs) Get(identifier string) (*SiteConfig, error)

type Source

type Source string

func (*Source) GetVersionSource

func (s *Source) GetVersionSource(version string) (string, error)

func (*Source) IsType

func (s *Source) IsType(t SourceType) bool

func (*Source) String

func (s *Source) String() string

func (*Source) Type

func (s *Source) Type() (SourceType, error)

type SourceType

type SourceType string
const (
	SourceTypeLocal     SourceType = "local"
	SourceTypeGit       SourceType = "git"
	SourceTypeGithub    SourceType = "github"
	SourceTypeBitbucket SourceType = "bitbucket"
	SourceTypeMercurial SourceType = "mercurial"
	SourceTypeHttp      SourceType = "http"
	SourceTypeS3        SourceType = "s3"
	SourceTypeGCS       SourceType = "gcs"
)

type SyntaxError

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

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

type TerraformConfig

type TerraformConfig struct {
	Providers   map[string]string `yaml:"providers"`
	RemoteState map[string]any    `yaml:"remote_state"`
}

type ValidationError

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

func (*ValidationError) Error

func (e *ValidationError) Error() string

type Value

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

type Variables

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

func NewVariables

func NewVariables() *Variables

func (*Variables) GetEncryptedSources

func (v *Variables) GetEncryptedSources(site string) []FileSource

func (*Variables) HasEncrypted

func (v *Variables) HasEncrypted(site string) bool

func (*Variables) InterpolateNode

func (v *Variables) InterpolateNode(node *yaml.Node) error

func (*Variables) InterpolateSiteNode

func (v *Variables) InterpolateSiteNode(site string, node *yaml.Node) error

func (*Variables) Load

func (v *Variables) Load(_ context.Context, filename, cwd string) error

Load creates a new Variables struct based on the contents of the given file.

func (*Variables) Set

func (v *Variables) Set(key string, value string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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