config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admission

type Admission struct {
	Amount int    `bson:"amount" json:"amount"`
	Unit   string `bson:"unit"   json:"unit"`
}

type Config

type Config struct {
	Environment     string           `yaml:"environment"`
	WebsocketServer websocket.Config `yaml:"ws_server"`
	HTTPServer      http.Config      `yaml:"http_server"`
	Database        database.Config  `yaml:"database"`
	Parameters      *Parameters
}

Config reprsents the configs used by relay and other concepts on system.

func Load

func Load(path string) (*Config, error)

Load loads config from file and env.

func (*Config) GetNIP11Documents

func (c *Config) GetNIP11Documents() *nip11.RelayInformationDocument

func (*Config) LoadParameters

func (c *Config) LoadParameters(db *database.Database) error

func (*Config) SetParameters

func (c *Config) SetParameters(db *database.Database, params *Parameters) error

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error represents an error in loading or validating config.

func (Error) Error

func (e Error) Error() string

type Fees

type Fees struct {
	Subscription []Subscription `bson:"subscription,omitempty" json:"subscription,omitempty"`
	Publication  []Publication  `bson:"publication,omitempty"  json:"publication,omitempty"`
	Admission    []Admission    `bson:"admission,omitempty"    json:"admission,omitempty"`
}

type Parameters

type Parameters struct {
	Handler         *handler.Config   `bson:"handler"                   json:"handler"`
	WebsocketServer *websocket.Config `bson:"server"                    json:"server"`
	Retention       *Retention        `bson:"retention,omitempty"       json:"retention,omitempty"`
	Fees            *Fees             `bson:"fees,omitempty"            json:"fees,omitempty"`
	Name            string            `bson:"name"                      json:"name"`
	Description     string            `bson:"description"               json:"description"`
	Pubkey          string            `bson:"pubkey"                    json:"pubkey"`
	Contact         string            `bson:"contact"                   json:"contact"`
	Software        string            `bson:"software"                  json:"software"`
	SupportedNips   []int             `bson:"supported_nips"            json:"supported_nips"`
	Version         string            `bson:"version"                   json:"version"`
	RelayCountries  []string          `bson:"relay_countries,omitempty" json:"relay_countries,omitempty"`
	LanguageTags    []string          `bson:"language_tags,omitempty"   json:"language_tags,omitempty"`
	Tags            []string          `bson:"tags,omitempty"            json:"tags,omitempty"`
	PostingPolicy   string            `bson:"posting_policy,omitempty"  json:"posting_policy,omitempty"`
	PaymentsURL     string            `bson:"payments_url,omitempty"    json:"payments_url,omitempty"`
	Icon            string            `bson:"icon,omitempty"            json:"icon,omitempty"`
}

type Publication

type Publication struct {
	Kinds  []int  `bson:"kinds"  json:"kinds"`
	Amount int    `bson:"amount" json:"amount"`
	Unit   string `bson:"unit"   json:"unit"`
}

type Retention

type Retention struct {
	Time  int         `bson:"time,omitempty"  json:"time,omitempty"`
	Count int         `bson:"count,omitempty" json:"count,omitempty"`
	Kinds interface{} `bson:"kinds,omitempty" json:"kinds,omitempty"`
}

type Subscription

type Subscription struct {
	Amount int    `bson:"amount" json:"amount"`
	Unit   string `bson:"unit"   json:"unit"`
	Period int    `bson:"period" json:"period"`
}

Jump to

Keyboard shortcuts

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