config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aliases

type Aliases map[string]string

type App

type App struct {
	Directory           string `yaml:"directory" mapstructure:"directory"`
	SearchURL           string `yaml:"search_url" mapstructure:"search_url"`
	LogLevel            string `yaml:"log_level" mapstructure:"log_level"`
	DebugSQL            bool   `yaml:"debug_sql" mapstructure:"debug_sql"`
	OpenResultsOnNewTab bool   `yaml:"open_results_on_new_tab" mapstructure:"open_results_on_new_tab"`
}

type Config

type Config struct {
	App                      App               `yaml:"app" mapstructure:"app"`
	Server                   Server            `yaml:"server" mapstructure:"server"`
	Hotkeys                  Hotkeys           `yaml:"hotkeys" mapstructure:"hotkeys"`
	SensitiveContentPatterns map[string]string `yaml:"sensitive_content_patterns" mapstructure:"sensitive_content_patterns"`
	Rules                    *Rules            `yaml:"-" mapstructure:"-"`
	// contains filtered or unexported fields
}

func CreateDefaultConfig

func CreateDefaultConfig() *Config

CreateDefaultConfig returns a new Config with default values.

func Load

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

Load reads and parses the configuration from the specified file.

func (*Config) BaseURL

func (c *Config) BaseURL(u string) string

func (*Config) DatabaseConnection

func (c *Config) DatabaseConnection() string

func (*Config) Filename

func (c *Config) Filename() string

func (*Config) FullPath

func (c *Config) FullPath(f string) string

func (*Config) Host

func (c *Config) Host() string

func (*Config) IndexPath

func (c *Config) IndexPath() string

func (*Config) IsSameHost added in v0.4.0

func (c *Config) IsSameHost(h string) bool

func (*Config) LoadRules

func (c *Config) LoadRules() error

func (*Config) RulesPath

func (c *Config) RulesPath() string

func (*Config) SaveRules

func (c *Config) SaveRules() error

func (*Config) SecretKey added in v0.4.0

func (c *Config) SecretKey() []byte

func (*Config) WebSocketURL

func (c *Config) WebSocketURL() string

type Hotkeys added in v0.3.0

type Hotkeys struct {
	Web map[string]string `yaml:"web" mapstructure:"web"`
	TUI map[string]string `yaml:"tui" mapstructure:"tui"`
}

func (Hotkeys) ToJSON added in v0.3.0

func (h Hotkeys) ToJSON() template.JS

func (Hotkeys) Validate added in v0.3.0

func (h Hotkeys) Validate() error

type Rule

type Rule struct {
	ReStrs []string
	// contains filtered or unexported fields
}

func (*Rule) Compile

func (r *Rule) Compile() error

func (*Rule) MarshalJSON

func (r *Rule) MarshalJSON() ([]byte, error)

func (*Rule) Match

func (r *Rule) Match(s string) bool

func (*Rule) UnmarshalJSON

func (r *Rule) UnmarshalJSON(data []byte) error

type Rules

type Rules struct {
	Skip     *Rule   `json:"skip"`
	Priority *Rule   `json:"priority"`
	Aliases  Aliases `json:"aliases"`
}

func (*Rules) Compile

func (r *Rules) Compile() error

func (*Rules) IsPriority

func (r *Rules) IsPriority(s string) bool

func (*Rules) IsSkip

func (r *Rules) IsSkip(s string) bool

func (*Rules) ResolveAliases

func (r *Rules) ResolveAliases(s string) string

type Server

type Server struct {
	Address  string `yaml:"address" mapstructure:"address"`
	BaseURL  string `yaml:"base_url" mapstructure:"base_url"`
	Database string `yaml:"database" mapstructure:"database"`
}

Jump to

Keyboard shortcuts

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