config

package
v0.0.0-...-926346d Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeploymentDir = "deployment"
	SSHPort       = 22
)
View Source
const (
	DefaultProjectsDir = "./projects"
	DefaultTemplateDir = "./deploy-template/nomad/deployment"
)

Variables

View Source
var (
	ErrNoConnection = errors.New("no connection defined")
)

Functions

func FileExists

func FileExists(fileName string) bool

func HTTPURLEnhancer

func HTTPURLEnhancer(address string) string

Types

type Config

type Config struct {
	TemplateDir   string         `hcl:"template_dir,optional"`
	GitProjectDir string         `hcl:"git_project_dir,optional"`
	Job           *JobConfig     `hcl:"job,block"`
	Environments  []*Environment `hcl:"env,block"`
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(hclBytes []byte, evalCtx *hcl.EvalContext) (*Config, error)

func NewDefaultConfig

func NewDefaultConfig(base *Config) (c *Config)

func (*Config) Destroy

func (c *Config) Destroy() error

func (*Config) GetEnvironment

func (c *Config) GetEnvironment(envKey string) *Environment

func (*Config) GetTemplateFile

func (c *Config) GetTemplateFile() (string, error)

func (*Config) GetVarFilesForEnv

func (c *Config) GetVarFilesForEnv(envId string) []string

func (*Config) GetVarFilesForEnvWithDir

func (c *Config) GetVarFilesForEnvWithDir(envId string, baseDir string) []string

type Connectable

type Connectable interface {
	Connect() (string, error)
}

type Connection

type Connection interface {
	Init(address string) error
	GetAddress() (string, error)
	Destroy() error
}

type ConnectionType

type ConnectionType string
const (
	ConnDirect ConnectionType = "direct"
	ConnSSH    ConnectionType = "ssh"
)

type Destroyable

type Destroyable interface {
	Destroy() error
}

type DirectConnection

type DirectConnection struct {
	// contains filtered or unexported fields
}

func (*DirectConnection) Destroy

func (c *DirectConnection) Destroy() error

func (*DirectConnection) GetAddress

func (c *DirectConnection) GetAddress() (string, error)

func (*DirectConnection) Init

func (c *DirectConnection) Init(address string) error

type DockerConfig

type DockerConfig struct {
	Registry string `hcl:"registry"`
}

type DockerImageResolver

type DockerImageResolver interface {
	Resolve() string
}

type Environment

type Environment struct {
	Name   string           `hcl:"name,label"`
	Nomad  *HashiConnConfig `hcl:"nomad,block"`
	Consul *HashiConnConfig `hcl:"consul,block"`
	Git    *GitConfig       `hcl:"git,block"`
	Docker *DockerConfig    `hcl:"docker,block"`
}

func (*Environment) Destroy

func (e *Environment) Destroy() error

func (*Environment) ID

func (e *Environment) ID() string

type EnvironmentID

type EnvironmentID string

type GitConfig

type GitConfig struct {
	DefaultRef      string      `hcl:"default_ref,optional"`
	DefaultProvider GitProvider `hcl:"default_provider,optional"`
}

type GitProvider

type GitProvider string

func (GitProvider) NormalizeSlug

func (p GitProvider) NormalizeSlug(slug string) string

type HashiConnConfig

type HashiConnConfig struct {
	Address          string `hcl:"address"`
	Token            string `hcl:"acl_token"`
	ConnectionConfig *conn  `hcl:"connection,block"`
	// contains filtered or unexported fields
}

func (*HashiConnConfig) Connect

func (c *HashiConnConfig) Connect() (string, error)

func (*HashiConnConfig) Destroy

func (c *HashiConnConfig) Destroy() error

type JobConfig

type JobConfig struct {
	TemplateFile string `hcl:"template,optional"`
}

type SSHConnection

type SSHConnection struct {
	Config *SSHConnectionConfig
	// contains filtered or unexported fields
}

SSHConnection is holding a ssh tunnel to remote address Dont use this in critical section

func (*SSHConnection) Destroy

func (conn *SSHConnection) Destroy() error

func (*SSHConnection) GetAddress

func (conn *SSHConnection) GetAddress() (string, error)

func (*SSHConnection) Init

func (conn *SSHConnection) Init(address string) error

type SSHConnectionConfig

type SSHConnectionConfig struct {
	Username string `hcl:"username"`
	KeyFile  string `hcl:"key_file"`
	Address  string `hcl:"address,optional"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳