config

package
v0.0.0-...-3e58e7c Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelConfig

type ChannelConfig struct {
	// The list of Trac instances allowed from this channel
	TracInstances []string `yaml:"trac_instances"`

	// The default Trac instance to query if a bug ID is given without an
	// explicit Trac ID.
	DefaultTracInstance string `yaml:"default_trac_instance,omitempty"`
}

ChannelConfig represents the configuration for a given channel. The Mattermost bot can join several channels, with a different configuration for each.

type Config

type Config struct {
	// URL of the Mattermost server, eg. http://server.domain:8080
	Server string `yaml:"server"`

	// Username of the bot on the Mattermost server
	Username string `yaml:"username"`

	// Password of the bot on the Mattermost server
	Password string `yaml:"password"`

	// Team of the bot on the Mattermost server
	Team string `yaml:"team"`

	// Go template (see the doc of template/text) for formatting ticket information
	TicketTemplate string `yaml:"ticket_template"`

	// List of configured Trac servers
	Tracs map[string]TracConfig `yaml:"tracs"`

	// Per-channel configuration
	Channels map[string]ChannelConfig `yaml:"channels"`
}

Config is the main configuration of the Mattermost bot.

func Load

func Load(r io.Reader) (Config, error)

func LoadFromFile

func LoadFromFile(filename string) (Config, error)

type TracConfig

type TracConfig struct {
	// URL of the Trac instance, eg. http://mytrac.domain:8080
	URL string `yaml:"url"`

	// Username of the bot on that Trac instance
	Username string `yaml:"username"`

	// Password of the bot on that Trac instance
	Password string `yaml:"password"`

	// Whether to accept HTTPS from unknown authorities
	Insecure bool `yaml:"insecure"`

	// The authentication mechanism to use:
	// - http: HTTP Basic Auth
	// - form: Trac login form
	AuthType string `yaml:"auth_type"`
}

TracConfig represents a configured Trac server. This server will be queried for ticket information.

Jump to

Keyboard shortcuts

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