config

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFileName     = "pctl.yml"
	DefaultComposeFile = "docker-compose.yml"

	// Build mode constants
	BuildModeRemoteBuild = "remote-build"
	BuildModeLoad        = "load"

	// Build parallel constants
	BuildParallelAuto = "auto"

	// Default build configuration values
	DefaultBuildMode            = BuildModeRemoteBuild
	DefaultBuildParallel        = BuildParallelAuto
	DefaultBuildTagFormat       = "pctl-{{stack}}-{{service}}:{{hash}}"
	DefaultBuildWarnThresholdMB = 50
)

Variables

This section is empty.

Functions

func GetDefaultComposeFile

func GetDefaultComposeFile() string

GetDefaultComposeFile returns the default compose file path

func GetDefaultSkipTLSVerify

func GetDefaultSkipTLSVerify() bool

GetDefaultSkipTLSVerify returns the default value for skip_tls_verify

func GetDefaultStackName

func GetDefaultStackName() string

GetDefaultStackName generates a default stack name based on the current directory

Types

type BuildConfig

type BuildConfig struct {
	Mode            string            `yaml:"mode"`              // remote-build | load
	Parallel        string            `yaml:"parallel"`          // auto | number
	TagFormat       string            `yaml:"tag_format"`        // template with {{stack}}, {{service}}, {{hash}}, {{timestamp}}
	Platforms       []string          `yaml:"platforms"`         // used for load mode local builds
	ExtraBuildArgs  map[string]string `yaml:"extra_build_args"`  // optional global overrides
	ForceBuild      bool              `yaml:"force_build"`       // force rebuild even if unchanged
	WarnThresholdMB int               `yaml:"warn_threshold_mb"` // WARN if tar/image stream exceeds this size
}

BuildConfig represents the build configuration

func (*BuildConfig) Validate

func (bc *BuildConfig) Validate() error

ValidateBuildConfig validates the build configuration

type Config

type Config struct {
	PortainerURL  string       `yaml:"portainer_url"`
	APIToken      string       `yaml:"api_token"`
	EnvironmentID int          `yaml:"environment_id"`
	StackName     string       `yaml:"stack_name"`
	ComposeFile   string       `yaml:"compose_file"`
	SkipTLSVerify bool         `yaml:"skip_tls_verify"`
	Build         *BuildConfig `yaml:"build,omitempty"`
}

Config represents the pctl configuration structure

func Load

func Load() (*Config, error)

Load reads and parses the pctl.yml configuration file

func (*Config) GetBuildConfig

func (c *Config) GetBuildConfig() *BuildConfig

GetBuildConfig returns the build configuration with defaults applied

func (*Config) Save

func (c *Config) Save() error

Save writes the configuration to pctl.yml

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if all required configuration fields are present

Jump to

Keyboard shortcuts

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