cfg

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: MIT Imports: 6 Imported by: 9

README

Cfg

GoDoc

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

View Source
var (
	// NoInertiaRemote is used to warn about missing inertia remote
	NoInertiaRemote = "No inertia remote"
)

Functions

func SetProperty added in v0.5.0

func SetProperty(name string, value string, structObject interface{}) bool

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

Types

type Config

type Config struct {
	Version       string `toml:"version"`
	Project       string `toml:"project-name"`
	BuildType     string `toml:"build-type"`
	BuildFilePath string `toml:"build-file-path"`

	Remotes map[string]*RemoteVPS `toml:"remotes"`
}

Config represents the current projects configuration.

func NewConfig

func NewConfig(version, project, buildType, buildFilePath string) *Config

NewConfig sets up Inertia configuration with given properties

func (*Config) AddRemote

func (config *Config) AddRemote(remote *RemoteVPS) bool

AddRemote adds a remote to configuration

func (*Config) GetRemote

func (config *Config) GetRemote(name string) (*RemoteVPS, bool)

GetRemote retrieves a remote by name

func (*Config) RemoveRemote

func (config *Config) RemoveRemote(name string) bool

RemoveRemote removes remote with given name

func (*Config) Write

func (config *Config) Write(filePath string, writers ...io.Writer) error

Write writes configuration to Inertia config file at path. Optionally takes io.Writers.

type DaemonConfig

type DaemonConfig struct {
	Port          string `toml:"port"`
	Token         string `toml:"token"`
	WebHookSecret string `toml:"webhook-secret"`
}

DaemonConfig contains parameters for the Daemon

type RemoteVPS

type RemoteVPS struct {
	Name            string        `toml:"name"`
	IP              string        `toml:"IP"`
	User            string        `toml:"user"`
	PEM             string        `toml:"pemfile"`
	Branch          string        `toml:"branch"`
	SSHPort         string        `toml:"ssh-port"`
	Daemon          *DaemonConfig `toml:"daemon"`
	DontKillOnDeath *bool         `toml:"no-kill-on-death"`
}

RemoteVPS contains parameters for the VPS

func (*RemoteVPS) GetHost

func (remote *RemoteVPS) GetHost() string

GetHost creates the user@IP string.

func (*RemoteVPS) GetIPAndPort

func (remote *RemoteVPS) GetIPAndPort() string

GetIPAndPort creates the IP:Port string.

Jump to

Keyboard shortcuts

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