config

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides types and functions to collect, validate and apply user-provided settings.

Index

Constants

View Source
const DefaultNagiosNotificationTimeout time.Duration = 30 * time.Second

DefaultNagiosNotificationTimeout is the default timeout value for Nagios 3 and 4 installations. This is our *default* timeout ceiling.

Variables

This section is empty.

Functions

func Branding

func Branding()

Branding is responsible for emitting application name, version and origin

func MessageTrailer

func MessageTrailer() string

MessageTrailer generates a branded "footer" for use with submitted Teams messages.

Types

type Config

type Config struct {

	// Team is the human-readable name of the Microsoft Teams "team" that
	// contains the channel we wish to post a message to. This is used in
	// informational output produced by this application only; the remote API
	// does not receive this value.
	Team string

	// Channel is human-readable name of the channel within a specific
	// Microsoft Teams "team". This is used in informational output produced
	// by this application only; the remote API does not receive this value.
	Channel string

	// WebhookURL is the full URL used to submit messages to the Teams channel
	// This URL is in the form of https://outlook.office.com/webhook/xxx or
	// https://outlook.office365.com/webhook/xxx. This URL is REQUIRED in
	// order for this application to function and needs to be created in
	// advance by adding/configuring a Webhook Connector in a Microsoft Teams
	// channel that you wish to submit messages to using this application.
	WebhookURL string

	// ThemeColor is a hex color code string representing the desired border
	// trim color for our submitted messages.
	ThemeColor string

	// MessageTitle is the text shown on the top portion of the message "card"
	// that is displayed in Microsoft Teams for the message that we send.
	MessageTitle string

	// MessageText is an (optionally) Markdown-formatted string representing
	// the message that we will submit.
	MessageText string

	// Retries is the number of attempts that this application will make
	// to deliver messages before giving up.
	Retries int

	// RetriesDelay is the number of seconds to wait between retry attempts.
	RetriesDelay int

	// Whether detailed output should be shown after message submission
	// success or failure.
	VerboseOutput bool

	// Whether ANY output should be shown after message submission success or
	// failure.
	SilentOutput bool

	// Whether messages with Windows, Mac and Linux newlines are updated to
	// use break statements before message submission.
	ConvertEOL bool

	// ShowVersion is a flag indicating whether the user opted to display only
	// the version string and then immediately exit the application
	ShowVersion bool
}

Config is a unified set of configuration values for this application. This struct is configured via command-line flags provided by the user.

func NewConfig

func NewConfig() (*Config, error)

NewConfig is a factory function that produces a new Config object based on user provided flag values.

func (Config) String

func (c Config) String() string

func (Config) TeamsSubmissionTimeout added in v0.4.11

func (c Config) TeamsSubmissionTimeout() time.Duration

TeamsSubmissionTimeout is the timeout value for sending messages to Microsoft Teams.

func (Config) Validate

func (c Config) Validate() error

Validate verifies all struct fields have been provided acceptable values

Jump to

Keyboard shortcuts

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