bot

package
v0.0.0-...-8c39811 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Router *chi.Mux
	Logger *zerolog.Logger
	Config *Config
	Client *gitlab.Client
}

Bot struct encapsulates all behaviour of the bot

func New

func New(config Config, policies string) (*Bot, error)

New creates a new bot taking the config filename and path from `main`'s arguments

func (*Bot) ServeHTTP

func (b *Bot) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the handler interface

type Config

type Config struct {
	User       string
	Token      string
	BotServer  string
	Endpoint   string
	Secret     string
	Host       string
	Port       string
	PolicyPath string
	DryRun     bool
	Policies   []policy.Policy `yaml:"policies"`
}

Config is the user declared details provided from the yaml file it contains general info for the bot along with a `Policies` property

type Message

type Message struct {
	Msg string `json:"msg"`
}

Message provides a simple message struct for times you need some kind of json response, like checking the health of the bot

Jump to

Keyboard shortcuts

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