config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigFile     = "knotidx.toml"
	DefaultGrpcPort       = 5319
	DefaultGrpcHost       = "localhost"
	DefaultGrpcSocketPath = "knotidx.sock"
	DefaultInterval       = 5 // seconds
	DefaultStoreType      = "badger"

	// GRPCServerTcpType represents the TCP type for the gRPC server.
	GrpcServerTcpType GRPCServerType = "tcp"
	// GrpcServerUnixType represents the Unix type for the gRPC server.
	GrpcServerUnixType GRPCServerType = "unix"
)

Default values for various configuration parameters.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Interval int             // Interval for indexing.
	GRPC     GRPCConfig      // gRPC server configuration.
	Store    StoreConfig     // Data store configuration.
	Indexer  []IndexerConfig // List of indexer configurations.
}

Config represents the overall application configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for the application.

func (Config) Load

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

Load reads configuration data from the specified file path in TOML format and updates the current configuration with the loaded values. If the file path is empty, the defaultConfigFile constant is used. The method returns the updated configuration and any encountered error during file reading or decoding.

type GRPCConfig

type GRPCConfig struct {
	Server bool           // Enable/disable the gRPC server.
	Port   int            // Port on which the gRPC server listens.
	Type   GRPCServerType // Type of the gRPC server (TCP or Unix).
	Path   string         // Path for Unix socket (if applicable).
	Host   string         // Host for TCP server.
}

GRPCConfig represents the configuration for the gRPC server.

type GRPCServerType

type GRPCServerType string

GRPCServerType represents the type of the gRPC server, either TCP or Unix.

type IndexerConfig

type IndexerConfig struct {
	Type               string   // Type of the indexer.
	Paths              []string // List of paths to index.
	Notify             bool     // Enable/disable file system notifications.
	ExcludeDirFilters  []string // List of directory filters to exclude during indexing.
	ExcludeFileFilters []string // List of file filters to exclude during indexing.
}

IndexerConfig represents the configuration for an indexer.

type StoreConfig

type StoreConfig struct {
	Type string // Type of the data store.
	Path string // Path for the data store.
}

StoreConfig represents the configuration for the data store.

Jump to

Keyboard shortcuts

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