config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigFile embed.FS

Content assets

View Source
var InitConfigFile = flag.String("init-config", "", "Initialize configuration file")

InitConfigFile initialize the config file

Functions

func ExportVars

func ExportVars(conf *Config)

ExportVars export some configuration variables to expvar

func WriteConfigFile

func WriteConfigFile(filename string) error

WriteConfigFile write configuration file

Types

type Config

type Config struct {
	Global       GlobalConfig       `toml:"global"`
	Integration  IntegrationConfig  `toml:"integration"`
	RateLimiting RateLimitingConfig `toml:"rate_limiting"`
	UserPlans    []UserPlan         `toml:"user_plans"`
}

Config is the root of the configuration

func NewConfig

func NewConfig() *Config

NewConfig create new configuration

func (Config) GetUserPlan

func (c Config) GetUserPlan(name string) (result *UserPlan)

GetUserPlan return an user plan by its name and fallback to first plan if missing

func (*Config) LoadFile

func (c *Config) LoadFile(path string) error

LoadFile loads the given config file

type Flags

type Flags struct {
	Config    string `flag:"config" desc:"Configuration file to load" default:""`
	LogLevel  string `flag:"log-level" desc:"Log level (debug, info, warn, error)" default:"info"`
	LogPretty bool   `flag:"log-pretty" desc:"Output human readable logs" default:"false"`
}

Flags of the command line

type GlobalConfig

type GlobalConfig struct {
	AuthN             string `toml:"authn"`
	DatabaseURI       string `toml:"db"`
	ListenAddr        string `toml:"listen_addr"`
	MetricsListenAddr string `toml:"metrics_listen_addr"`
	SMTPListenAddr    string `toml:"smtp_listen_addr"`
	PublicURL         string `toml:"public_url"`
	UILocation        string `toml:"ui"`
	SecretSalt        string `toml:"secret_salt"`
	BlockList         string `toml:"block_list"`
}

GlobalConfig is the global configuration section

type IntegrationConfig

type IntegrationConfig struct {
	ExternalEventBrokerURI string `toml:"external_event_broker_uri"`
	ExternalWebScraperURL  string `toml:"external_web_scraper_url"`
	ImageProxyURL          string `toml:"image_proxy_url"`
	PDFGeneratorURL        string `toml:"pdf_generator_url"`
	AvatarProvider         string `toml:"avatar_provider"`
	SecretsEngineProvider  string `toml:"secrets_engine_provider"`
	Sentry                 SentryConfiguration
	Pocket                 PocketConfiguration
}

IntegrationConfig is the integration configuration section

type PocketConfiguration

type PocketConfiguration struct {
	ConsumerKey string `toml:"consumer_key"`
}

PocketConfiguration is the Pocket's integration configuration

type RateLimiting

type RateLimiting struct {
	// Provider of the rate limiting store
	Provider string `toml:"provider"`
	//Tokens allowed per interval
	Tokens int `toml:"tokens"`
	// Interval until tokens reset
	Interval duration `toml:"interval"`
}

RateLimiterConfig is the configuration of a rate-limiter

type RateLimitingConfig

type RateLimitingConfig struct {
	Notification RateLimiting
	Webhook      RateLimiting
}

RateLimitingConfig is rate-limiting configuration section

type SentryConfiguration

type SentryConfiguration struct {
	DSN string `toml:"dsn_url"`
}

SentryConfiguration is the Sentry's integration configuration

type UserPlan

type UserPlan struct {
	Name                    string   `toml:"name" json:"name"`
	ArticlesLimit           uint     `toml:"articles_limit" json:"articles_limit"`
	CategoriesLimit         uint     `toml:"categories_limit" json:"categories_limit"`
	IncomingWebhooksLimit   uint     `toml:"incoming_webhooks_limit" json:"incoming_webhooks_limit"`
	OutgoingWebhooksLimit   uint     `toml:"outgoing_webhooks_limit" json:"outgoing_webhooks_limit"`
	OutgoingWebhooksTimeout duration `toml:"outgoing_webhooks_timeout" json:"outgoing_webhooks_timeout"`
}

UserPlanConfig is the configuration a a user plan

Directories

Path Synopsis
Package configflag converts strings to snake_case or CamelCase
Package configflag converts strings to snake_case or CamelCase

Jump to

Keyboard shortcuts

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