config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitbucket

type Bitbucket struct {
	Host       string
	Username   string
	Password   string
	Project    string
	Repository string
}

Bitbucket credentials/options

func (Bitbucket) IsEnabled

func (c Bitbucket) IsEnabled() bool

type Calendar

type Calendar struct {
	Path   string
	Name   string
	Events []CalendarEvent
	Ical   ics.Event `yaml:"-"` // todo temporary way to pass Ical event
}

Calendar is able to trigger commands based on ical calendar events

type CalendarEvent

type CalendarEvent struct {
	Name     string
	Pattern  string
	Channel  string
	Commands []string
}

CalendarEvent is one single calender config which should be watched

type Config

type Config struct {
	Slack       Slack     `yaml:"slack"`
	Server      Server    `yaml:"server"`
	Jenkins     Jenkins   `yaml:"jenkins"`
	Jira        Jira      `yaml:"jira"`
	Mqtt        Mqtt      `yaml:"mqtt"`
	StoragePath string    `yaml:"storage_path"`
	Bitbucket   Bitbucket `yaml:"bitbucket"`
	Github      struct {
		AccessToken string
	}
	Gitlab struct {
		AccessToken string
		Host        string
	}
	Macros    []Macro
	Crons     []Cron
	Logger    Logger
	Calendars []Calendar

	// @deprecated
	BranchLookup struct {
		Type       string // stash/bitbucket/git/null
		Repository string
	} `yaml:"branch_lookup"`

	AllowedUsers []string    `yaml:"allowed_users,flow"`
	AdminUsers   []string    `yaml:"admin_users,flow"`
	OpenWeather  OpenWeather `yaml:"open_weather"`
	Timezone     string      `yaml:"timezone"`
}

Config contains the full config structure of this bot

func LoadPattern

func LoadPattern(pattern string) (Config, error)

LoadPattern loads config yaml file(s) by a glob pattern

type Cron

type Cron struct {
	Channel  string
	Schedule string
	Commands []string
}

Cron is represents a single cron which can be configured

type Jenkins

type Jenkins struct {
	Host     string
	Username string
	Password string
	Jobs     JenkinsJobs
}

Jenkins is the main Jenkins config, including credentials and the whitelisted jobs

func (Jenkins) IsEnabled

func (c Jenkins) IsEnabled() bool

IsEnabled checks if a host was defined...by default it's not set

type JenkinsJobs

type JenkinsJobs map[string]JobConfig

JenkinsJobs is the list of all (whitelisted) Jenkins jobs

type Jira

type Jira struct {
	Host     string
	Username string
	Password string
	Project  string
	Fields   []JiraField
}

Jira configuration: credentials and custom formatting options

func (Jira) IsEnabled

func (c Jira) IsEnabled() bool

IsEnabled checks if a host is defined (username/password) is not needed for public projects

type JiraField

type JiraField struct {
	Name  string
	Icons map[string]string
}

JiraField are custom Jira issue fields which should be displayed in the search/output Icons can be provided to have special mapping, e.g. for bug type or different priorities

type JobConfig

type JobConfig struct {
	Parameters []JobParameter
	Trigger    string
	OnStart    []string
	OnSuccess  []string
	OnFailure  []string
}

JobConfig concrete job configuration -> only defined jobs are (re)startable

type JobParameter

type JobParameter struct {
	Name    string
	Default string
	Type    string
}

JobParameter are defined build parameters per job

type Logger

type Logger struct {
	Level string `yaml:"level"`
	File  string `yaml:"file"`
}

type Macro

type Macro struct {
	Name        string
	Description string
	Trigger     string
	Commands    []string
	Examples    []string
}

Macro represents a single macro which is defined by a trigger regexp and a list of executed commands

type Mqtt

type Mqtt struct {
	Host     string
	Username string
	Password string
}

Mqtt is a optional MQTT client to publish and subscribe values from the defined broker

func (Mqtt) IsEnabled

func (c Mqtt) IsEnabled() bool

type OpenWeather

type OpenWeather struct {
	Apikey   string
	Location string
	Url      string
	Units    string
}

OpenWeather is an optional feature to get current weather

type Server

type Server struct {
	Listen             string `yaml:"listen"`
	VerificationSecret string `yaml:"verification_secret"`
}

func (Server) IsEnabled added in v1.3.0

func (c Server) IsEnabled() bool

type Slack

type Slack struct {
	Token            string   `yaml:"token"`
	Debug            bool     `yaml:"debug"`
	AllowedGroups    []string `yaml:"allowed_groups,flow"`
	AutoJoinChannels []string `yaml:"auto_join_channels,flow"`
	ErrorChannel     string   `yaml:"error_channel"`

	// only used for integration tests
	TestEndpointUrl   string `yaml:"-"`
	VerificationToken string `yaml:"-"`
}

Slack contains the credentials and configuration of the Slack client

Jump to

Keyboard shortcuts

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