config

package
v0.25.4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CORECTL_DIR    = ".config"
	CORECTL_CONFIG = "corectl.yaml"
)

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

func RegisterBoolParameterAsFlag added in v0.24.0

func RegisterBoolParameterAsFlag(p *Parameter[bool], fs *pflag.FlagSet)

func RegisterStringParameterAsFlag

func RegisterStringParameterAsFlag(p *Parameter[string], fs *pflag.FlagSet)

func ResetConfigRepositoryState

func ResetConfigRepositoryState(repositoryParam *Parameter[string], dryRun bool) (*git.LocalRepository, error)

Types

type Config

type Config struct {
	GitHub       GitHubConfig       `yaml:"github"`
	Repositories RepositoriesConfig `yaml:"repositories"`
	P2P          P2PConfig          `yaml:"p2p"`
	// contains filtered or unexported fields
}

func DiscoverConfig

func DiscoverConfig() (*Config, error)

func NewConfig added in v0.24.0

func NewConfig() *Config

func NewTestPersistedConfig added in v0.24.0

func NewTestPersistedConfig() *Config

func ReadConfig

func ReadConfig(path string) (*Config, error)

func (*Config) BaseDir added in v0.23.0

func (c *Config) BaseDir() (string, error)

func (*Config) IsPersisted

func (c *Config) IsPersisted() bool

func (*Config) Path

func (c *Config) Path() string

func (*Config) Save

func (c *Config) Save() error

func (*Config) SetValue added in v0.24.0

func (c *Config) SetValue(yamlPath string, value string) (*Config, error)

SetValue changes config value by yamlPath if possible and returns an updated copy of the `c`

type GitHubConfig added in v0.25.2

type GitHubConfig struct {
	Token        Parameter[string] `yaml:"token"`
	Organization Parameter[string] `yaml:"organization"`
}

type P2PConfig added in v0.25.2

type P2PConfig struct {
	FastFeedback P2PStageConfig `yaml:"fast-feedback"`
	ExtendedTest P2PStageConfig `yaml:"extended-test"`
	Prod         P2PStageConfig `yaml:"prod"`
}

type P2PStageConfig

type P2PStageConfig struct {
	DefaultEnvs Parameter[[]string] `yaml:"default-envs"`
}

type Parameter

type Parameter[V interface{}] struct {
	Value V
	// contains filtered or unexported fields
}

func (Parameter[V]) MarshalYAML

func (p Parameter[V]) MarshalYAML() (interface{}, error)

MarshalYAML It's important to use here value receiver, since we define parameters as values (not references) in configuration

func (*Parameter[V]) Name

func (p *Parameter[V]) Name() string

func (*Parameter[V]) UnmarshalYAML

func (p *Parameter[V]) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML It's important to use reference receiver, so we modify the actual Parameter struct and not a local copy

type RepositoriesConfig added in v0.25.2

type RepositoriesConfig struct {
	CPlatform  Parameter[string] `yaml:"cplatform"`
	Templates  Parameter[string] `yaml:"templates"`
	AllowDirty Parameter[bool]   `yaml:"allow-dirty"`
}

Jump to

Keyboard shortcuts

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