config

package
v0.0.0-...-a3dbc15 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CRLF = []byte{13, 10}
	LF   = []byte{10}
)

Functions

func ConvertFileToCRLF

func ConvertFileToCRLF(filePath string) error

ConvertFileToCRLF converts line endings in a file to CRLF.

func GetDebug

func GetDebug() bool

func InitConfig

func InitConfig() error

InitConfig will initialize the configuration from environment variables. This will set 'SlackConfig' to the loaded configuration.

Types

type Config

type Config struct {
	// Required configuration
	AccessToken string
	Channels    string

	// Trigger matching
	BranchPattern      string
	TagPattern         string
	EventToSendMessage string
	JobBranch          string
	JobStatus          string
	JobTag             string

	// Flags
	Debug        bool
	IgnoreErrors string
	InvertMatch  string

	// Message template
	TemplateInline string
	TemplateName   string
	TemplatePath   string
	TemplateVar    string

	// Overridable for testing
	SlackAPIBaseUrl string
}

Config represents the configuration loaded from environment variables.

var SlackConfig Config

func (*Config) Validate

func (c *Config) Validate() error

Validate checks whether the necessary environment variables are set.

type EnvVarError

type EnvVarError struct {
	VarName string
}

func (*EnvVarError) Error

func (e *EnvVarError) Error() string

type ExpansionError

type ExpansionError struct {
	FieldName string
	Err       error
}

func (*ExpansionError) Error

func (e *ExpansionError) Error() string

Jump to

Keyboard shortcuts

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