config

package
v0.0.0-...-8803770 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Name                string   `json:"channelName"`
	MinimumValue        int      `json:"minimumValue"`
	MaximumValue        int      `json:"maximumValue"`
	ExcludeLosses       bool     `json:"excludeLosses"`
	IncludeCharacters   []string `json:"includeCharacters"`
	IncludeCorporations []string `json:"includeCorporations"`
	IncludeAlliances    []string `json:"includeAlliances"`
	ExcludedShips       []string `json:"excludedShips"`
}

Channel defines the configuration for a slack channel in a team, including its filters

type Configuration

type Configuration struct {
	FilePath     string  `json:"-"`
	TemplateFile string  `json:"templateFile"`
	UserAgent    string  `json:"userAgent"`
	Teams        []*Team `json:"teams"`
	// contains filtered or unexported fields
}

Configuration holds the configuration for the application.

func ReadConfig

func ReadConfig(filepath string) (cfg *Configuration, err error)

ReadConfig accepts a file path and returns the parsed configuration, if found. If the file was not found, or could not be parsed, an error is returned and the configuration model is nil.

func (*Configuration) File

func (cfg *Configuration) File() string

File returns the file name/path for gonfig interface

func (*Configuration) Load

func (cfg *Configuration) Load() error

Load the configuration from the FilePath. This overwrites any unsaved changes. Returns an error for an unset file path or any file system permission level errors.

func (*Configuration) Save

func (cfg *Configuration) Save() error

Save the configuration file on the file path set in Configuration.FilePath.

type Team

type Team struct {
	BotToken   string        `json:"botToken"`
	Channels   []Channel     `json:"channels"`
	Bot        *slack.Client `json:"-"` // Used only during run time.
	FailedAuth bool          `json:"-"` // Used only during run time. Denotes a failed token.
}

Team is the configuration object for a Slack team.

Jump to

Keyboard shortcuts

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