settings

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: ISC Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZKSIdentityFilename = "brserver.id"
	ZKSCertFilename     = "brserver.crt"
	ZKSKeyFilename      = "brserver.key"
	ZKSRoutedMessages   = "routedmessages"
	ZKSPaidRVs          = "paidrvs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	// default section
	Root            string        // root directory for brserver
	RoutedMessages  string        // routed messages
	PaidRVs         string        // paid for RVs
	Listen          []string      // listen addresses and port
	InitSessTimeout time.Duration // How long to wait for session on a new connection
	ClientVersions  string        // Suggested list of client versions (comma separated key=value)

	// policy section
	ExpirationDays    int // How many days after which to expire data
	MaxMsgSizeVersion rpc.MaxMsgSizeVersion
	PingLimit         time.Duration

	// payment section
	PayScheme               string
	LNRPCHost               string
	LNTLSCert               string
	LNMacaroonPath          string
	PushPayRateMAtoms       uint64
	PushPayRateBytes        uint64
	PushPayRateMinMAtoms    uint64
	MilliAtomsPerSub        uint64
	PushPaymentLifetime     int // how long a payment to a push is valid
	MaxPushInvoices         int
	MilliAtomsPerRTSess     uint64
	MilliAtomsPerUserRTSess uint64
	MilliAtomsGetCookie     uint64
	MilliAtomsPerUserCookie uint64
	MilliAtomsRTJoin        uint64
	MilliAtomsRTPushRate    uint64
	RTPushRateMBytes        uint64

	// log section
	LogFile    string // log filename
	DebugLevel string // debug level config string
	TimeFormat string // debug file time stamp format
	Profiler   string // go profiler link

	// Postgres config
	PGEnabled         bool
	PGHost            string
	PGPort            string
	PGDBName          string
	PGRoleName        string
	PGPassphrase      string
	PGServerCA        string
	PGIndexTableSpace string
	PGBulkTableSpace  string

	// Postgres replication config
	PGSlotName   string
	PGCmdPromote string
	PGCmdDemote  string

	// RTDT config
	RTDTServerAddr       string
	RTDTServerPub        *zkidentity.FixedSizeSntrupPublicKey
	RTDTCookieKey        *zkidentity.FixedSizeSymmetricKey
	RTDTDecodeCookieKeys []*zkidentity.FixedSizeSymmetricKey

	// Versioner is a function that returns the current app version.
	Versioner func() string

	// LogStdOut is the stdout to write the log to. Defaults to os.Stdout.
	LogStdOut io.Writer

	// SeederAddr is the websocket host of the brseeder.
	SeederAddr string

	// SeederToken is the token from the brseeder.
	SeederToken string

	// SeederDisable disables the use of brseeder.
	SeederDisable bool

	// SeederDryRun pretends to follow seeder's commands.
	SeederDryRun bool

	// SeederInsecure may be set to true to use ws:// instead of wss:// as
	// protocol.
	SeederInsecure bool

	// LNRpcGetInfoMock may be set during tests to mock the lnRpc.GetInfo()
	// call.
	LNRpcGetInfoMock func() (*lnrpc.GetInfoResponse, error)
}

Settings is the collection of all brserver settings. This is separated out in order to be able to reuse in various tests.

func New

func New() *Settings

New returns a default settings structure.

func (*Settings) Load

func (s *Settings) Load(filename string) error

Load retrieves settings from an ini file. Additionally it expands all ~ to the current user home directory.

func (*Settings) SeederProto added in v0.2.4

func (s *Settings) SeederProto() string

Jump to

Keyboard shortcuts

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