configs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = Configuration{
	AdminUsername:   "REPLACE_ME",
	Listen:          ":8080",
	Logger:          []zapwriter.Config{DefaultLoggerConfig},
	DatabaseType:    "sqlite3",
	DatabaseURL:     "./github2telegram.DB",
	PollingInterval: 5 * time.Minute,
	ProcessingFeeds: make(map[string]bool),
}
View Source
var DefaultLoggerConfig = zapwriter.Config{
	Logger:           "",
	File:             "stdout",
	Level:            "debug",
	Encoding:         "json",
	EncodingTime:     "iso8601",
	EncodingDuration: "seconds",
}

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	sync.RWMutex
	Listen           string                        `yaml:"listen"`
	Logger           []zapwriter.Config            `yaml:"logger"`
	DatabaseType     string                        `yaml:"database_type"`
	DatabaseURL      string                        `yaml:"database_url"`
	DatabaseLogin    string                        `yaml:"database_login"`
	DatabasePassword string                        `yaml:"database_password"`
	AdminUsername    string                        `yaml:"admin_username"`
	PollingInterval  time.Duration                 `yaml:"polling_interval"`
	Endpoints        map[string]NotificationConfig `yaml:"endpoints"`

	DB              *sql.DB                          `yaml:"-"`
	Senders         map[string]NotificationEndpoints `yaml:"-"`
	FeedsConfig     []*FeedsConfig                   `yaml:"-"`
	CurrentId       int                              `yaml:"-"`
	ProcessingFeeds map[string]bool                  `yaml:"-"`
}

func (*Configuration) GetDB

func (c *Configuration) GetDB() *sql.DB

type FeedsConfig

type FeedsConfig struct {
	Repo    string
	Filters []FiltersConfig

	PollingInterval time.Duration
	Notifications   []string
}

type FiltersConfig

type FiltersConfig struct {
	Name           string
	Filter         string
	MessagePattern string

	FilterRegex     *regexp.Regexp
	FilterProcessed bool
	LastUpdateTime  time.Time
	LastTag         string
}

type NotificationConfig

type NotificationConfig struct {
	Token string
	Url   string
	Type  string
}

type NotificationEndpoints

type NotificationEndpoints interface {
	Send(url, filter, message string) error
	Process()
}

Jump to

Keyboard shortcuts

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