config

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config loads an app configuration as specified in a config.yml

For a full guide visit https://github.com/mcereal/botty

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckChannel

func CheckChannel(o ICheckChannel) (string, error)

CheckChannel checks for the correct webhook for the environment

func LoadConfiguration

func LoadConfiguration()

LoadConfiguration is for loading config from files and environment and setting it ready to be read.

Types

type ChannelType

type ChannelType struct {
	Channel, ChannelType string
}

ChannelType holds the type of channel and webhhok value

type Config

type Config struct {
	Application struct {
		Name        string `default:"cs-code-review-bot" yaml:"name"`
		Environment string `default:"production" yaml:"environment"`
	} `yaml:"application"`
	Server struct {
		Port string `default:"8080" yaml:"port"`
	} `yaml:"server"`
	Github struct {
		GitHubURL   string `default:"https://api.github.com" yaml:"github_url"`
		GitHubToken string `default:"" yaml:"github_token"`
	} `yaml:"github"`
	Team []TeamSettings `yaml:"team_name"`
}

Config is a struct in yaml format for storing configs for the application.

var AppConfig Config

AppConfig is the package level variable exposing the applications configs.

type ICheckChannel

type ICheckChannel interface {
	// contains filtered or unexported methods
}

ICheckChannel is an interface for checking channel details

type TeamSettings

type TeamSettings struct {
	Name                string   `yaml:"name"`
	Channel             string   `yaml:"channel"`
	ChannelType         string   `yaml:"channel_type"`
	EnableCron          bool     `default:"true" yaml:"enable_cron"`
	CronElapsedDuration int      `default:"14400000000000" yaml:"cron_elapsed_duration"`
	Owner               string   `yaml:"owner"`
	Repos               []string `yaml:"repos"`
	IgnoreUsers         []string `yaml:"ignore_users"`
}

TeamSettings holds the team settings

Jump to

Keyboard shortcuts

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