cfg

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig() error

Types

type Config

type Config struct {
	// RsshubUrl RSSHub url used by the app.
	// The default https://rsshub.app actually cannot work with Telegram.
	// You should deploy RSSHub on your own.
	// If you need authentication, see the option as a URL and add them on querystring.
	// We can process it properly.
	RsshubUrl string

	// TgChanName Telegram channel slug to be forwarded.
	// If your channel link is https://t.me/myl7s, use `myl7s` here.
	TgChanName string

	// PostFilterOut Message containing the slug will be filtered.
	// See also https://docs.rsshub.app/parameter.html#nei-rong-guo-lu .
	// You may use | to separate multiply keywords.
	PostFilterOut string

	// PollInterval Polling time interval to request RSSHub.
	// The default cache age of RSSHub when caching is enabled is 300s.
	// So if you want smaller update interval for quicker syncing,
	// you need to not only decrease the variable but also disable/reconfigure RSSHub caching.
	// Unit: s.
	PollInterval int

	// PollRange The time range of each polling request to RSSHub.
	// The option is directly used as `filter_time` param for RSSHub.
	// PollRange / PollInterval indicates how many times will a message be tried to forward.
	// If your RSSHub is fine enough, set PollRange = 1 * PollInterval, which means only one try.
	// Otherwise, PollRange = 2 * PollInterval or 3 * PollInterval should be better.
	// Unit: s.
	PollRange int

	// DBPath SQLite database file path
	DBPath string

	// TwConsumerKey The following 4 is Twitter secrets. See `README.md` to know how to get them.
	TwConsumerKey    string
	TwConsumerSecret string
	TwTokenKey       string
	TwTokenSecret    string

	// TwTextSplitBackRate When searching at the end of body text for a possible split position, the range proportion.
	// The result of dividing the int with 100 should be in 0-1.
	TwTextSplitBackRate int

	// TwTextSplitBackDisableRate When set, disable the searching of TwTextSplitBackRate
	TwTextSplitBackDisableRate bool

	// TwTextSplitBackLen Like TwTextSplitBackRate, but in int length counted in UTF-16 encoding.
	// The default 20 chars should be large enough to cross an English word and reach a space separating point.
	TwTextSplitBackLen int

	// TwTextSplitBackDisableLen Like TwTextSplitBackDisableRate but for TwTextSplitBackLen.
	// When all of TwTextSplitBackDisable* is set, the text splitting will fall back to just choose the end point,
	// which means no attempt to split at a maybe better position will be taken.
	TwTextSplitBackDisableLen bool

	// TmpDir Temporary dir path.
	// Make sure it exists and is accessible by the app.
	// Multiply directories may be created as tmp dir for different purposes in it.
	TmpDir string

	// DryRun Run the app but do not actually send the messages to be forwarded to Twitter.
	DryRun bool

	// OnErrEmail If not empty, report error messages to the email address. Requires SMTP is configured and enabled.
	OnErrEmail string

	// Name Descriptive name to identify the instance when in situations like error report.
	// Use server hostname by default.
	Name string

	// DisableSmtp The following options configure SMTP for services like error report.
	// TLS/SSL and STARTTLS is automatically detected.
	DisableSmtp  bool
	SmtpHost     string
	SmtpPort     int // 465 by default
	SmtpUsername string
	SmtpPassword string
	SmtpSender   string
}
var Cfg *Config

func GetConfig

func GetConfig() (*Config, error)

Jump to

Keyboard shortcuts

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