config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UIConfigFile embed.FS

Content assets

Functions

func ExportVars

func ExportVars(conf *Config)

ExportVars export some configuration variables to expvar

Types

type AuthNBasicConfig added in v1.0.0

type AuthNBasicConfig struct {
	HtpasswdFile string `toml:"htpasswd_file"`
}

AuthBasicConfig for basci authentication configuration section

type AuthNConfig added in v1.0.0

type AuthNConfig struct {
	Method string `toml:"method"`
	Admins string `toml:"admins"`
	Basic  AuthNBasicConfig
	OIDC   AuthNOIDCConfig
	Proxy  AuthNProxyConfig
}

AuthNConfig for authentication configuration section

type AuthNOIDCConfig added in v1.0.0

type AuthNOIDCConfig struct {
	Issuer       string `toml:"issuer"`
	ClientID     string `toml:"client_id"`
	ClientSecret string `toml:"client_secret"`
}

AuthNOIDCConfig for OpenID Connect authentication configuration section

type AuthNProxyConfig added in v1.0.0

type AuthNProxyConfig struct {
	Headers string `toml:"headers"`
}

AuthNProxyConfig for proxy authentication configuration section

type AvatarConfig added in v1.0.0

type AvatarConfig struct {
	ServiceProvider string `toml:"service_provider"`
}

AvatarConfig for avatar configuration section

type Config

type Config struct {
	Log          LogConfig          `toml:"log"`
	Database     DatabaseConfig     `toml:"database"`
	HTTP         HTTPConfig         `toml:"http"`
	Metrics      MetricsConfig      `toml:"metrics"`
	SMTP         SMTPConfig         `toml:"smtp"`
	AuthN        AuthNConfig        `toml:"authn"`
	UI           UIConfig           `toml:"ui"`
	Hash         HashConfig         `toml:"hash"`
	Scraping     ScrapingConfig     `toml:"scraping"`
	Avatar       AvatarConfig       `toml:"avatar"`
	Image        ImageConfig        `toml:"image"`
	PDF          PDFConfig          `toml:"pdf"`
	Secrets      SecretsConfig      `toml:"secrets"`
	Event        EventConfig        `toml:"event"`
	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

func (*Config) WriteDefaultConfigFile added in v1.2.0

func (c *Config) WriteDefaultConfigFile(filename string) error

WriteDefaultConfigFile write default configuration file

func (*Config) WriteUIConfigFile added in v1.2.0

func (c *Config) WriteUIConfigFile(filename string) error

WriteUIConfigFile write configuration file

type DatabaseConfig added in v1.0.0

type DatabaseConfig struct {
	URI string `toml:"uri"`
}

DatabaseConfig for database configuration section

type EventConfig added in v1.0.0

type EventConfig struct {
	BrokerURI string `toml:"broker_uri"`
}

EventConfig for event configuration section

type HTTPConfig added in v1.0.0

type HTTPConfig struct {
	ListenAddr string `toml:"listen_addr"`
	PublicURL  string `toml:"public_url"`
}

HTTPConfig for HTTP configuration section

type HashConfig added in v1.0.0

type HashConfig struct {
	SecretKey  hex_string `toml:"secret_key"`
	SecretSalt hex_string `toml:"secret_salt"`
}

HashConfig for hash configuration section

type ImageConfig added in v1.0.0

type ImageConfig struct {
	ProxyURL   string `toml:"proxy_url"`
	ProxySizes string `toml:"proxy_sizes"`
	Cache      string `toml:"cache"`
}

ImageConfig for image configuration section

type IntegrationConfig

type IntegrationConfig struct {
	Sentry SentryConfiguration
	Pocket PocketConfiguration
}

IntegrationConfig for integration configuration section

type LogConfig added in v1.0.0

type LogConfig struct {
	Level  string `toml:"level"`
	Format string `toml:"format"`
}

LogConfig for log configuration section

type MetricsConfig added in v1.0.0

type MetricsConfig struct {
	ListenAddr string `toml:"listen_addr"`
}

MetricsConfig for metrics configuration section

type PDFConfig added in v1.0.0

type PDFConfig struct {
	ServiceProvider string `toml:"service_provider"`
}

PDFConfig for PDF configuration section

type PocketConfiguration

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

PocketConfiguration for 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 for rate-limiter configuration section

type RateLimitingConfig

type RateLimitingConfig struct {
	Notification RateLimiting
	Webhook      RateLimiting
}

RateLimitingConfig for rate-limiting configuration section

type SMTPConfig added in v1.0.0

type SMTPConfig struct {
	ListenAddr string `toml:"listen_addr"`
	Hostname   string `toml:"hostname"`
}

SMTPConfig for SMTP configuration section

type ScrapingConfig added in v1.0.0

type ScrapingConfig struct {
	ServiceProvider string `toml:"service_provider"`
	BlockList       string `toml:"block_list"`
}

ScrapingConfig for scraping configuration section

type SecretsConfig added in v1.0.0

type SecretsConfig struct {
	ServiceProvider string `toml:"service_provider"`
}

SecretsConfig for secrets configuration section

type SentryConfiguration

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

SentryConfiguration for Sentry's integration configuration

type UIConfig added in v1.0.0

type UIConfig struct {
	Directory string `toml:"directory"`
	PublicURL string `toml:"public_url"`
	ClientID  string `toml:"client_id"`
}

UIConfig for UI configuration section

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 for user-plan configuration sections

Jump to

Keyboard shortcuts

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