config

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName     = "daily-webhooks"
	AppFullName = "github.com/fantasticmao/" + AppName
)
View Source
const (
	WebhookEnumBark     = "bark"
	WebhookEnumDingTalk = "dingtalk"
	WebhookEnumDiscard  = "discard"
	WebhookEnumEmail    = "email"
)
View Source
const (
	FetchTaskEnumChinesePoetry  = "chinese-poetry"
	FetchTaskEnumExecShell      = "exec-shell"
	FetchTaskEnumHealthCheck    = "health-check"
	FetchTaskEnumPokemonWiki    = "pokemon-wiki"
	FetchTaskEnumTodayInHistory = "today-in-history"
)

Variables

View Source
var (
	Version    = "unknown version"
	BuildTime  = "unknown time"
	CommitHash = "unknown commit"
)
View Source
var (
	ErrUnsupportedChannel = errors.New("unsupported channel")
	ErrUnsupportedRender  = errors.New("unsupported render")
	ErrInvalidResponse    = errors.New("invalid response error")
)

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Name                string `yaml:"name"`
	Type                string `yaml:"type"`
	BarkCustomServer    string `yaml:"bark-custom-server"`    // optional, used for [bark]
	BarkDeviceKey       string `yaml:"bark-device-key"`       // optional, used for [bark]
	BarkCustomIcon      string `yaml:"bark-custom-icon"`      // optional, used for [bark]
	DingTalkServer      string `yaml:"dingtalk-server"`       // optional, used for [dingtalk]
	DingTalkAccessToken string `yaml:"dingtalk-access-token"` // optional, used for [dingtalk]
	DingTalkSecret      string `yaml:"dingtalk-secret"`       // optional, used for [dingtalk]
	EmailServer         string `yaml:"email-server"`          // optional, used for [email]
	EmailUsername       string `yaml:"email-username"`        // optional, used for [email]
	EmailPassword       string `yaml:"email-password"`        // optional, used for [email]
	EmailFrom           string `yaml:"email-from"`            // optional, used for [email]
	EmailTo             string `yaml:"email-to"`              // optional, used for [email]
}

type Config

type Config struct {
	LogLevel   string      `yaml:"log-level"`
	Http       HttpConf    `yaml:"http"`
	Channels   []Channel   `yaml:"channels"`
	FetchTasks []FetchTask `yaml:"fetch-tasks"`
}

func Init

func Init(confDir, confFile string) *Config

type FetchTask

type FetchTask struct {
	Type                 string                    `yaml:"type"`
	Cron                 string                    `yaml:"cron"`
	ChannelNames         []string                  `yaml:"channels"`
	ChinesePoetryServer  string                    `yaml:"chinese-poetry-server"`   // optional, used for [chinese-poetry]
	ChinesePoetryToken   string                    `yaml:"chinese-poetry-token"`    // optional, used for [chinese-poetry]
	TodayInHistoryServer string                    `yaml:"today-in-history-server"` // optional, used for [today-in-history]
	ExecShellScript      string                    `yaml:"exec-shell-script"`       // optional, used for [exec-shell]
	HealthCheckApis      []FetchTaskHealthCheckApi `yaml:"health-check-apis"`       // optional, used for [health-check]
}

type FetchTaskHealthCheckApi

type FetchTaskHealthCheckApi struct {
	Name string `yaml:"name"`
	Url  string `yaml:"url"`
}

type HttpConf

type HttpConf struct {
	Timeout    int    `yaml:"timeout"`
	Proxy      string `yaml:"proxy"`
	RetryTimes int    `yaml:"retry-times"`
}

Jump to

Keyboard shortcuts

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