config

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: MIT Imports: 6 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 `mapstructure:"host"`
	Username   string `mapstructure:"username"`
	Password   string `mapstructure:"password"`
	APIKey     string `mapstructure:"api_key"`
	Project    string `mapstructure:"project"`
	Repository string `mapstructure:"repository"`
}

Bitbucket credentials/options. Either add Username+Password OR a APIKey

func (*Bitbucket) IsEnabled

func (c *Bitbucket) IsEnabled() bool

type Config

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

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

	AllowedUsers UserList    `mapstructure:"allowed_users,flow"`
	AdminUsers   UserList    `mapstructure:"admin_users,flow"`
	OpenWeather  OpenWeather `mapstructure:"open_weather"`
	PullRequest  PullRequest `mapstructure:"pullrequest"`
	Timezone     string      `mapstructure:"timezone"`
}

Config contains the full config structure of this bot

func Load added in v1.6.0

func Load(configFile string) (Config, error)

Load loads config yaml file(s) inside a directory or a single .yaml file

type Cron

type Cron struct {
	Channel  string   `mapstructure:"channel"`
	Schedule string   `mapstructure:"schedule"`
	Commands []string `mapstructure:"commands"`
}

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 `mapstructure:"level"`
	File  string `mapstructure:"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 `mapstructure:"host"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

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 PullRequest added in v1.6.0

type PullRequest struct {
	// able to set a custom "approved" reactions to see directly who or which component/department approved a pullrequest
	CustomApproveReaction map[string]string `mapstructure:"custom_approve_reaction"`
}

PullRequest special configuration to change the pull request behavior

type Server

type Server struct {
	Listen        string `mapstructure:"listen"`
	SigningSecret string `mapstructure:"signing_secret"`
}

func (Server) IsEnabled added in v1.3.0

func (c Server) IsEnabled() bool

type Slack

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

	// use websocket RTM connection.
	// this is NOT possible anymore for new apps!
	UseRTM      bool `mapstructure:"use_rtm"`
	UseEventAPI bool `mapstructure:"use_event_api"`

	// only used for integration tests
	TestEndpointURL   string `mapstructure:"-"`
	VerificationToken string `mapstructure:"-"`
}

Slack contains the credentials and configuration of the Slack client

type UserList added in v1.6.2

type UserList []string

func (UserList) Contains added in v1.6.2

func (l UserList) Contains(userID string) bool

Jump to

Keyboard shortcuts

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