configs

package
v0.0.0-...-60192f8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package configs contains Readeck configuration.

Index

Constants

This section is empty.

Variables

View Source
var Config = config{
	Main: configMain{
		LogLevel:      "info",
		DevMode:       false,
		DataDirectory: "data",
	},
	Server: configServer{
		Host: "127.0.0.1",
		Port: 8000,
		Session: configSession{
			CookieName: "sxid",
			MaxAge:     86400 * 30,
		},
	},
	Database: configDB{},
	Email: configEmail{
		Port: 25,
	},
	Worker: configWorker{
		DSN:         "memory://",
		NumWorkers:  max(1, runtime.NumCPU()-1),
		StartWorker: true,
	},
	Extractor: configExtractor{
		NumWorkers:     runtime.NumCPU(),
		ContentScripts: []string{"data/content-scripts"},
		DeniedIPs: []configIPNet{
			newConfigIPNet("127.0.0.0/8"),
			newConfigIPNet("::1/128"),
		},
		ProxyMatch: []configProxyMatch{},
	},
	Metrics: configMetrics{
		Host: "127.0.0.1",
		Port: 0,
	},
}

Config holds the configuration data from configuration files or flags.

This variable sets some default values that might be overwritten by a configuration file.

Functions

func BuildTime

func BuildTime() time.Time

BuildTime returns the build time or, if empty, the time when the application started.

func CookieBlockKey

func CookieBlockKey() []byte

CookieBlockKey returns the key used by session cookies.

func CookieHashKey

func CookieHashKey() []byte

CookieHashKey returns the key used by session cookies.

func CsrfKey

func CsrfKey() []byte

CsrfKey returns the key used by CSRF protection.

func ExtractorDeniedIPs

func ExtractorDeniedIPs() []*net.IPNet

ExtractorDeniedIPs returns the value of Config.Extractor.DeniedIPs as a slice of *net.IPNet.

func GenerateKey

func GenerateKey(minLen, maxLen int) string

GenerateKey returns a random key.

func HashValue

func HashValue(s []byte) []byte

HashValue returns the hash of the given value, encoded using the main secret key.

func InitConfiguration

func InitConfiguration()

InitConfiguration applies some default computed values on the configuration.

func JwtPk

func JwtPk() ed25519.PublicKey

JwtPk returns the public key for JWT handlers.

func JwtSk

func JwtSk() ed25519.PrivateKey

JwtSk returns the private key for JWT handlers.

func LoadConfiguration

func LoadConfiguration(configPath string) error

LoadConfiguration loads the configuration file.

func Version

func Version() string

Version returns the current readeck version.

func WriteConfig

func WriteConfig(filename string) error

WriteConfig writes configuration to a file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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