config

package
v0.0.0-...-91dbc65 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package config contains the configuration schema and some utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Logger      Logger      `yaml:"logger"`
	SSE         SSE         `yaml:"sse"`
	RateLimiter RateLimiter `yaml:"rate_limiter"`
}

API configuration.

type Config

type Config struct {
	Notifier  Notifier  `yaml:"notifier"`
	DB        DB        `yaml:"db"`
	Lottery   Lottery   `yaml:"lottery"`
	Tor       Tor       `yaml:"tor"`
	Lightning Lightning `yaml:"lightning"`
	API       API       `yaml:"api"`
	Server    Server    `yaml:"server"`
}

Config represents the configuration for the BTRY application.

func New

func New() (Config, error)

New returns a configuration object loaded from a file.

func (Config) Validate

func (c Config) Validate() error

Validate returns an error if the configuration is not valid.

type DB

type DB struct {
	Path            string        `yaml:"path"`
	Logger          Logger        `yaml:"logger"`
	MaxIdleConns    int           `yaml:"max_idle_conns"`
	ConnMaxIdleTime time.Duration `yaml:"conn_max_idle_time"`
}

DB database configuration.

type Lightning

type Lightning struct {
	RPCAddress   string `yaml:"rpc_address"`
	TLSCertPath  string `yaml:"tls_cert_path"`
	MacaroonPath string `yaml:"macaroon_path"`
	Logger       Logger `yaml:"logger"`
	MaxFeePPM    int64  `yaml:"max_fee_ppm"`
}

Lightning configuration.

type Logger

type Logger struct {
	Label   string `yaml:"label"`
	OutFile string `yaml:"out_file"`
	Level   uint8  `yaml:"level"`
}

Logger configuration.

type Lottery

type Lottery struct {
	Logger   Logger `yaml:"logger"`
	Duration uint32 `yaml:"duration"`
}

Lottery configuration.

type Nostr

type Nostr struct {
	PrivateKey string   `yaml:"private_key"`
	Relays     []string `yaml:"relays"`
}

Nostr configuration.

type Notifier

type Notifier struct {
	Telegram Telegram `yaml:"telegram"`
	Nostr    Nostr    `yaml:"nostr"`
	Logger   Logger   `yaml:"logger"`
	Enabled  bool     `yaml:"enabled"`
}

Notifier configuration.

type RateLimiter

type RateLimiter struct {
	Tokens   uint64        `yaml:"tokens"`
	Interval time.Duration `yaml:"interval"`
}

RateLimiter configuration.

type SSE

type SSE struct {
	Logger   Logger        `yaml:"logger"`
	Deadline time.Duration `yaml:"deadline"`
}

SSE configuration.

type Server

type Server struct {
	Address         string            `yaml:"address"`
	TLSCertificates []tls.Certificate `yaml:"tls_certificates"`
	Logger          Logger            `yaml:"logger"`
	Timeout         struct {
		Read     time.Duration `yaml:"read"`
		Write    time.Duration `yaml:"write"`
		Shutdown time.Duration `yaml:"shutdown"`
		Idle     time.Duration `yaml:"idle"`
	} `yaml:"timeout"`
}

Server configuration.

type Telegram

type Telegram struct {
	BotAPIToken string `yaml:"bot_api_token"`
	BotName     string `yaml:"bot_name"`
}

Telegram configuration.

type Tor

type Tor struct {
	Address string        `yaml:"address"`
	Timeout time.Duration `yaml:"timeout"`
}

Tor configuration.

Jump to

Keyboard shortcuts

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