config

package
v0.0.0-...-09eda65 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	Hash    string
	Message string
}

type CommitList

type CommitList []Commit

func (CommitList) Hashes

func (c CommitList) Hashes() []string

type Config

type Config struct {
	Provider   string `json:"provider"`
	Repository string `json:"repository"`
	Branch     string `json:"branch"`
	Commit     string `json:"commit"`
	// StoreDir is the path where services config are stored
	StoreDir string `json:"-"`
	// Path is the location of the config file
	Path   string `json:"-"`
	Logger *log.Logger
	Git    *Git
}

Config contains nest's configuration

func NewConfig

func NewConfig(configPath string, storePath string, log *log.Logger) (*Config, error)

NewConfig creates a new config It isn't used while testing, make sure to reflect the changes you make here in the tests using the Config.

func (*Config) Clone

func (c *Config) Clone() error

func (*Config) LoadCommit

func (c *Config) LoadCommit(commit string) error

func (*Config) Pull

func (c *Config) Pull() error

func (*Config) Read

func (c *Config) Read(file string) ([]byte, error)

func (*Config) RemoteURL

func (c *Config) RemoteURL() string

func (*Config) Save

func (c *Config) Save() error

func (*Config) ServicesConfig

func (c *Config) ServicesConfig() (*ServicesConfig, error)

func (*Config) StorePath

func (c *Config) StorePath() string

type Git

type Git struct {
	Logger *log.Logger
}

func (Git) Clone

func (g Git) Clone(remote string, local string, branch string) error

func (Git) Exists

func (g Git) Exists(dir, path, commit string) bool

func (Git) ListCommits

func (g Git) ListCommits(dir string, branch string) (CommitList, error)

func (Git) Pull

func (g Git) Pull(dir string, branch string) ([]byte, error)

func (Git) ReadFile

func (g Git) ReadFile(dir string, commit string, file string) ([]byte, error)

type NetworkConfiguration

type NetworkConfiguration struct {
	// todo: implement smallest_subnet policy once subnetter is thoroughly tested
	Policy  string   `yaml:"policy" json:"policy"` // "smallest_subnet", "/{mask size}"
	Subnets []string `yaml:"subnets" json:"subnets"`
}

func (*NetworkConfiguration) MarshalJSON

func (n *NetworkConfiguration) MarshalJSON() ([]byte, error)

type RegistryMap

type RegistryMap map[string]*docker.Registry

RegistryMap maps registry names to their respective docker.Registry structs

func (*RegistryMap) UnmarshalYAML

func (r *RegistryMap) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface

type ServicesConfig

type ServicesConfig struct {
	Services     service.ServiceMap `yaml:"services" json:"services"`
	Registries   RegistryMap        `yaml:"registries" json:"registries"`
	ControlPlane struct {
		Host string `yaml:"host" json:"host"`
	} `yaml:"control_plane" json:"controlPlane"`
	Proxy struct {
		HTTP       string `yaml:"http" json:"http"`
		HTTPS      string `yaml:"https" json:"https"`
		SelfSigned bool   `yaml:"self_signed" json:"selfSigned"`
	} `yaml:"proxy" json:"proxy"`
	Network NetworkConfiguration `yaml:"network" json:"network"`
}

ServicesConfig represents nest's config

func (*ServicesConfig) ExpandIncludes

func (c *ServicesConfig) ExpandIncludes(config *Config) error

func (*ServicesConfig) MarshalJSON

func (c *ServicesConfig) MarshalJSON() ([]byte, error)

func (*ServicesConfig) UnmarshalYAML

func (c *ServicesConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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