config

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DocsHandlersSrcDir = "github.com/grokify/chathooks/docs/handlers"
	IconBaseURL        = "http://grokify.github.io/chathooks/icons/"
	EmojiURLFormat     = "https://grokify.github.io/emoji/assets/images/%s.png"

	InfoInputMessageParseBegin   = "INFO - Input Message Parse Begin"
	ErrorInputMessageParseFailed = "FAIL - Input Message Parse Failed"
)
View Source
const (
	ParamNameAdapters        = "adapters"
	ParamNameActivityDefault = "defaultActivity"
	ParamNameIconDefault     = "defaultIcon"
	ParamNameInputType       = "inputType"
	ParamNameOutputType      = "outputType"
	ParamNameOutputFormat    = "outputFormat" // `card`, `adaptivecard`, `nocard`. Default is `card`.
	ParamNameOutputURL       = "outputURL"
	ParamNameToken           = "token"
	EnvPath                  = "ENV_PATH"
	EnvEngine                = "CHATHOOKS_ENGINE" // awslambda, nethttp, fasthttp
	EnvTokens                = "CHATHOOKS_TOKENS"
	EnvWebhookURL            = "CHATHOOKS_URL"
	EnvHomeURL               = "CHATHOOKS_HOME_URL"
	ErrRequiredTokenNotFound = "401.01 Required Token Not Found"
	ErrRequiredTokenNotValid = "401.02 Required Token Not Valid"

	ParamNameOutputFormatNocard       = "nocard"
	ParamNameOutputFormatCard         = "card"
	ParamNameOutputFormatAdaptivecard = "adaptivecard"
)
View Source
const (
	DefaultIconFile = "icon_webhookrc_512x512.png"
)

Variables

View Source
var Icons = map[string]string{
	"aha":        "icon_aha_256x256.png",
	"appsignal":  "icon_appsignal_400x400.png",
	"apteligent": "icon_apteligent_496x496.png",
	"bugsnag":    "icon_bugsnag_512x512.png",
	"circleci":   "icon_circleci_128x128.png",
	"codeship":   "icon_codeship_512x512.png",
	"confluence": "icon_confluence_256x256.png",
	"datadog":    "icon_datadog_512x512.png",
	"deskdotcom": "icon_deskdotcom_400x400.png",
	"enchant":    "icon_enchant_400x400.png",
	"gosquared":  "icon_gosquared_128x128.png",
	"heroku":     "icon_heroku_512x512.png",
	"librato":    "icon_librato_128x128.png",
	"magnumci":   "icon_magnumci_400x400.png",
	"marketo":    "icon_marketo_250x250.png",
	"opsgenie":   "icon_opsgenie_128x128.png",
	"papertrail": "icon_papertrail_128x128.png",
	"pingdom":    "icon_pingdom_512x512.png",
	"raygun":     "icon_raygun_512x512.png",
	"runscope":   "icon_runscope_400x400.png",
	"semaphore":  "icon_semaphore_512x512.png",
	"statuspage": "icon_statuspage_512x512.png",
	"travisci":   "icon_travisci_225x225.png",
	"userlike":   "icon_userlike_512x512.png",
	"victorops":  "icon_victorops_225x225.png",
	"wootric":    "icon_wootric_200x200.png"}

Functions

func DocsHandlersDir

func DocsHandlersDir() string

func MustParseOutputFormat added in v0.7.0

func MustParseOutputFormat(input string) string

Types

type Configuration

type Configuration struct {
	Port           int      `env:"PORT" envDefault:"3000"`
	Engine         string   `env:"CHATHOOKS_ENGINE" envDefault:"fasthttp"`
	HomeURL        string   `env:"CHATHOOKS_HOME_URL"`
	WebhookURL     string   `env:"CHATHOOKS_WEBHOOK_URL"`
	Tokens         []string `env:"CHATHOOKS_TOKENS" envSeparator:","`
	LogFormat      string   `env:"CHATHOOKS_LOG_FORMAT"`
	EmojiURLFormat string
	IconBaseURL    string
	LogLevel       zerolog.Level
}

Configuration is the webhook proxy configuration struct.

func NewConfigurationEnv

func NewConfigurationEnv() (Configuration, error)

func ReadConfigurationFile

func ReadConfigurationFile(filepath string) (Configuration, error)

func (*Configuration) Address

func (c *Configuration) Address() string

Address returns the port address as a string with a `:` prefix

func (*Configuration) GetAppIconURL

func (c *Configuration) GetAppIconURL(appSlug string) (*url.URL, error)

Jump to

Keyboard shortcuts

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