README

Cfg

PkgGoDev

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

Expand ▾ Collapse ▴

Documentation

Overview

    Package cfg provides configuration structs and types

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func SetProperty

    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

      type Build struct {
      	Type          BuildType `toml:"type"`
      	BuildFilePath string    `toml:"buildfile"`
      
      	IntermediaryContainers []string `toml:"intermediary_containers"`
      }

        Build denotes build configuration

        type BuildType

        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

          func AsBuildType(s string) (BuildType, error)

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

            type Daemon

            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

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

                Notifiers defines options for notifications on a profile

                type Profile

                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

                  func (p *Profile) Identifier() string

                    Identifier implements identity.Identifier

                    type Project

                    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

                      func NewProject(name, host string) *Project

                        NewProject sets up Inertia configuration with given properties

                        func (*Project) GetProfile

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

                          GetProfile retrieves the named profile

                          func (*Project) RemoveProfile

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

                            RemoveProfile removes a configured profile

                            func (*Project) SetProfile

                            func (p *Project) SetProfile(profile Profile)

                              SetProfile assigns a profile to project configuration

                              func (*Project) ValidateVersion

                              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

                                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

                                  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

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

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

                                      func (*Remote) GetProfile

                                      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

                                        func (r *Remote) Identifier() string

                                          Identifier implements identity.Identifier

                                          func (*Remote) SSHHost

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

                                            SSHHost creates the user@ip string for executing SSH commands

                                            type Remotes

                                            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

                                              func NewRemotesConfig() *Remotes

                                                NewRemotesConfig instantiates a new Inertia configuration

                                                func (*Remotes) GetRemote

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

                                                  GetRemote retrieves a remote by name

                                                  func (*Remotes) RemoveRemote

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

                                                    RemoveRemote removes remote with given name

                                                    func (*Remotes) SetRemote

                                                    func (i *Remotes) SetRemote(remote Remote)

                                                      SetRemote adds or updates a remote to configuration

                                                      type SSH

                                                      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.