inertia: github.com/ubclaunchpad/inertia/cfg Index | Files | Directories

package cfg

import "github.com/ubclaunchpad/inertia/cfg"

Package cfg provides configuration structs and types

Index

Package Files

doc.go identity.go project.go remote.go remotes.go util.go

func SetProperty Uses

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

type Build Uses

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

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

Build denotes build configuration

type BuildType Uses

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 Uses

func AsBuildType(s string) (BuildType, error)

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

type Daemon Uses

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 Uses

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

Notifiers defines options for notifications on a profile

type Profile Uses

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 Uses

func (p *Profile) Identifier() string

Identifier implements identity.Identifier

type Project Uses

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 Uses

func NewProject(name, host string) *Project

NewProject sets up Inertia configuration with given properties

func (*Project) GetProfile Uses

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

GetProfile retrieves the named profile

func (*Project) RemoveProfile Uses

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

RemoveProfile removes a configured profile

func (*Project) SetProfile Uses

func (p *Project) SetProfile(profile Profile)

SetProfile assigns a profile to project configuration

func (*Project) ValidateVersion Uses

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 Uses

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 Uses

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 Uses

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

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

func (*Remote) GetProfile Uses

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 Uses

func (r *Remote) Identifier() string

Identifier implements identity.Identifier

func (*Remote) SSHHost Uses

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

SSHHost creates the user@ip string for executing SSH commands

type Remotes Uses

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 Uses

func NewRemotesConfig() *Remotes

NewRemotesConfig instantiates a new Inertia configuration

func (*Remotes) GetRemote Uses

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

GetRemote retrieves a remote by name

func (*Remotes) RemoveRemote Uses

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

RemoveRemote removes remote with given name

func (*Remotes) SetRemote Uses

func (i *Remotes) SetRemote(remote Remote)

SetRemote adds or updates a remote to configuration

type SSH Uses

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

PathSynopsis
internal/identityPackage identity provides a small set of utilities for dealing with structs that have an identifier.

Package cfg imports 7 packages (graph) and is imported by 19 packages. Updated 2021-01-15. Refresh now. Tools for package owners.