config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifactory

type Artifactory struct {
	URL        string         `yaml:"url,omitempty" json:"url,omitempty" validate:"required"`
	ApiKey     string         `yaml:"apiKey,omitempty" json:"apiKey,omitempty" validate:"required"`
	ApiKeyFile string         `yaml:"apiKeyFile,omitempty" json:"apiKeyFile,omitempty" validate:"omitempty,file"`
	Timeout    *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
}

Artifactory holds Artifactory details

func (*Artifactory) GetDefaults

func (s *Artifactory) GetDefaults() *Artifactory

GetDefaults gets the default values

func (*Artifactory) SetDefaults

func (s *Artifactory) SetDefaults()

SetDefaults sets the default values

type Cli

type Cli struct {
	Version         kong.VersionFlag
	Cfgfile         string `kong:"name='config',env='CONFIG',help='Configuration file.'"`
	LogLevel        string `kong:"name='log-level',env='LOG_LEVEL',default='info',help='Set log level.'"`
	LogJSON         bool   `kong:"name='log-json',env='LOG_JSON',default='false',help='Enable JSON logging output.'"`
	LogCaller       bool   `kong:"name='log-caller',env='LOG_CALLER',default='false',help='Add file:line of the caller to log output.'"`
	DryRun          bool   `kong:"name='dry-run',env='DRY_RUN',default='false',help='If enabled files will not be removed.'"`
	DisableSchedule bool   `` /* 128-byte string literal not displayed */
}

Cli holds command line args, flags and cmds

type Config

type Config struct {
	Cli         Cli          `yaml:"-" json:"-" label:"-" file:"-"`
	Meta        Meta         `yaml:"-" json:"-" label:"-" file:"-"`
	Artifactory *Artifactory `yaml:"artifactory,omitempty" json:"artifactory,omitempty" validate:"required"`
	Policies    Policies     `yaml:"policies,omitempty" json:"policies,omitempty" validate:"required,unique=Name,dive"`
}

Config holds configuration details

func Load

func Load(cli Cli, meta Meta) (*Config, error)

Load returns Configuration struct

func (*Config) String

func (cfg *Config) String() string

String returns the string representation of configuration

type Meta

type Meta struct {
	ID        string
	Name      string
	Desc      string
	URL       string
	Author    string
	Version   string
	UserAgent string
}

Meta holds application details

type Policies

type Policies []Policy

Policies holds slice of policy

type Policy

type Policy struct {
	Name           string         `yaml:"name,omitempty" json:"name,omitempty" validate:"required"`
	Repos          []string       `yaml:"repos,omitempty" json:"repos,omitempty" validate:"required"`
	Schedule       string         `yaml:"schedule,omitempty" json:"schedule,omitempty" validate:"required"`
	Retention      *time.Duration `yaml:"retention,omitempty" json:"retention,omitempty" validate:"required"`
	LastModified   *bool          `yaml:"lastModified,omitempty" json:"lastModified,omitempty" validate:"required"`
	LastDownloaded *bool          `yaml:"lastDownloaded,omitempty" json:"lastDownloaded,omitempty" validate:"required"`
	Common         *PolicyCommon  `yaml:"common,omitempty" json:"common,omitempty"`
	Docker         *PolicyDocker  `yaml:"docker,omitempty" json:"docker,omitempty"`
}

Policy holds policy configuration

func (*Policy) GetDefaults

func (s *Policy) GetDefaults() *Policy

GetDefaults gets the default values

func (*Policy) SetDefaults

func (s *Policy) SetDefaults()

SetDefaults sets the default values

type PolicyCommon added in v0.2.0

type PolicyCommon struct {
	Include []string `yaml:"include,omitempty" json:"include,omitempty"`
	Exclude []string `yaml:"exclude,omitempty" json:"exclude,omitempty"`
}

PolicyCommon holds common's policy configuration

func (*PolicyCommon) GetDefaults added in v0.2.0

func (s *PolicyCommon) GetDefaults() *PolicyCommon

GetDefaults gets the default values

func (*PolicyCommon) SetDefaults added in v0.2.0

func (s *PolicyCommon) SetDefaults()

SetDefaults sets the default values

type PolicyDocker

type PolicyDocker struct {
	KeepSemver *bool    `yaml:"keepSemver,omitempty" json:"keepSemver,omitempty"`
	Exclude    []string `yaml:"exclude,omitempty" json:"exclude,omitempty"`
}

PolicyDocker holds docker's policy configuration

func (*PolicyDocker) GetDefaults

func (s *PolicyDocker) GetDefaults() *PolicyDocker

GetDefaults gets the default values

func (*PolicyDocker) IsExcluded

func (s *PolicyDocker) IsExcluded(tag string) bool

IsExcluded checks if a tag is excluded

func (*PolicyDocker) SetDefaults

func (s *PolicyDocker) SetDefaults()

SetDefaults sets the default values

Jump to

Keyboard shortcuts

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