cfg

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 7 Imported by: 9

README

Cfg

PkgGoDev

This package contains Inertia's configuration types, structs, etc.

Documentation

Overview

Package cfg provides configuration structs and types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetProperty added in v0.5.0

func SetProperty(name string, value string, obj interface{}) error

SetProperty takes a struct pointer and searches for its "toml" tag with a search key and set property value with the tag

Types

type Build added in v0.6.0

type Build struct {
	Type          BuildType `toml:"type"`
	BuildFilePath string    `toml:"buildfile"`

	IntermediaryContainers []string `toml:"intermediary_containers"`
}

Build denotes build configuration

type BuildType added in v0.6.0

type BuildType string

BuildType represents supported build types

const (
	// Dockerfile is used for plain Dockerfile builds
	Dockerfile BuildType = "dockerfile"

	// DockerCompose is used for docker-compose configurations
	DockerCompose BuildType = "docker-compose"
)

func AsBuildType added in v0.6.0

func AsBuildType(s string) (BuildType, error)

AsBuildType casts given string as a BuildType, or returns an error

type Daemon added in v0.6.0

type Daemon struct {
	Port          string `toml:"port"`
	Token         string `toml:"token"`
	User          string `toml:"user,omitempty"`
	WebHookSecret string `toml:"webhook-secret"`
	VerifySSL     bool   `toml:"verify-ssl"`
}

Daemon contains parameters for the Daemon

type Notifiers added in v0.6.0

type Notifiers struct {
	SlackNotificationURL string `toml:"slack_notification_url"`
}

Notifiers defines options for notifications on a profile

type Profile added in v0.6.0

type Profile struct {
	Name      string     `toml:"name"`
	Branch    string     `toml:"branch"`
	Build     *Build     `toml:"build"`
	Notifiers *Notifiers `toml:"notifiers"`
}

Profile denotes a deployment configuration

func (*Profile) Identifier added in v0.6.0

func (p *Profile) Identifier() string

Identifier implements identity.Identifier

type Project added in v0.6.0

type Project struct {
	// InertiaMinVersion declares a minimum inertia version
	InertiaMinVersion string `toml:"version"`

	Name string `toml:"name"`
	URL  string `toml:"url"`

	// Profiles tracks configured project profiles. It is a list instead of a map
	// to better align with TOML best practices
	Profiles []*Profile `toml:"profile"`
}

Project represents the current project's configuration.

func NewProject added in v0.6.0

func NewProject(name, host string) *Project

NewProject sets up Inertia configuration with given properties

func (*Project) GetProfile added in v0.6.0

func (p *Project) GetProfile(name string) (*Profile, bool)

GetProfile retrieves the named profile

func (*Project) RemoveProfile added in v0.6.0

func (p *Project) RemoveProfile(name string) bool

RemoveProfile removes a configured profile

func (*Project) SetProfile added in v0.6.0

func (p *Project) SetProfile(profile Profile)

SetProfile assigns a profile to project configuration

func (*Project) ValidateVersion added in v0.6.1

func (p *Project) ValidateVersion(v string) (warning string, err error)

ValidateVersion checks if the given version is compatible with the project version. It errors if the incompatibility is strict, otherwise returns an error message.

type Remote added in v0.6.0

type Remote struct {
	Version string `toml:"version"`
	Name    string `toml:"name"`

	IP     string  `toml:"ip"`
	SSH    *SSH    `toml:"ssh"`
	Daemon *Daemon `toml:"daemon"`

	Profiles map[string]string `toml:"profiles"`
}

Remote contains parameters for the VPS

func (*Remote) ApplyProfile added in v0.6.0

func (r *Remote) ApplyProfile(project, profile string)

ApplyProfile associates the given profile name with the given project and saves it in Profiles

func (*Remote) DaemonAddr added in v0.6.0

func (r *Remote) DaemonAddr() (string, error)

DaemonAddr creates the IP:Port string for making requests to the Daemon

func (*Remote) GetProfile added in v0.6.0

func (r *Remote) GetProfile(project string) string

GetProfile retrieves the configured profile for the named project. If no profile is found, `default` is returned

func (*Remote) Identifier added in v0.6.0

func (r *Remote) Identifier() string

Identifier implements identity.Identifier

func (*Remote) SSHHost added in v0.6.0

func (r *Remote) SSHHost() (string, error)

SSHHost creates the user@ip string for executing SSH commands

type Remotes added in v0.6.0

type Remotes struct {
	// Remotes tracks globally configured remotes. It is a list instead of a map
	// to better align with TOML best practices
	Remotes []*Remote `toml:"remote"`
}

Remotes denotes global Inertia configuration

func NewRemotesConfig added in v0.6.0

func NewRemotesConfig() *Remotes

NewRemotesConfig instantiates a new Inertia configuration

func (*Remotes) GetRemote added in v0.6.0

func (i *Remotes) GetRemote(name string) (*Remote, bool)

GetRemote retrieves a remote by name

func (*Remotes) RemoveRemote added in v0.6.0

func (i *Remotes) RemoveRemote(name string) bool

RemoveRemote removes remote with given name

func (*Remotes) SetRemote added in v0.6.0

func (i *Remotes) SetRemote(remote Remote)

SetRemote adds or updates a remote to configuration

type SSH added in v0.6.0

type SSH struct {
	User         string `toml:"user"`
	IdentityFile string `toml:"identityfile"`
	SSHPort      string `toml:"ssh-port"`
}

SSH denotes SSH options for accessing a remote

Directories

Path Synopsis
internal
identity
Package identity provides a small set of utilities for dealing with structs that have an identifier.
Package identity provides a small set of utilities for dealing with structs that have an identifier.

Jump to

Keyboard shortcuts

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