config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Level           int              `json:"level" yaml:"level"`
	Path            string           `json:"path" yaml:"path"`
	Format          string           `json:"format" yaml:"format"`
	Output          string           `json:"output" yaml:"output"`
	OutputFile      string           `json:"output_file" yaml:"output_file"`
	IndexName       string           `json:"index_name" yaml:"index_name"`
	DateSuffix      string           `json:"date_suffix" yaml:"date_suffix"`
	RotateDaily     bool             `json:"rotate_daily" yaml:"rotate_daily"`
	Desensitization *Desensitization `json:"desensitization" yaml:"desensitization"`
	Meilisearch     *Meilisearch     `json:"meilisearch" yaml:"meilisearch"`
	Elasticsearch   *Elasticsearch   `json:"elasticsearch" yaml:"elasticsearch"`
	OpenSearch      *OpenSearch      `json:"opensearch" yaml:"opensearch"`
}

Config configuration struct

func GetConfig

func GetConfig(v *viper.Viper) *Config

GetConfig returns the logger configuration with date suffix support

func (*Config) BuildIndexName

func (c *Config) BuildIndexName(t time.Time) string

BuildIndexName builds full index name with date suffix

func (*Config) GetCurrentIndexName

func (c *Config) GetCurrentIndexName() string

GetCurrentIndexName gets current index name with today's date

type Desensitization

type Desensitization struct {
	Enabled               bool     `json:"enabled" yaml:"enabled"`
	SensitiveFields       []string `json:"sensitive_fields" yaml:"sensitive_fields"`
	CustomPatterns        []string `json:"custom_patterns" yaml:"custom_patterns"`
	PreservePrefix        int      `json:"preserve_prefix" yaml:"preserve_prefix"`
	PreserveSuffix        int      `json:"preserve_suffix" yaml:"preserve_suffix"`
	MaskChar              string   `json:"mask_char" yaml:"mask_char"`
	UseFixedLength        bool     `json:"use_fixed_length" yaml:"use_fixed_length"`
	FixedMaskLength       int      `json:"fixed_mask_length" yaml:"fixed_mask_length"`
	ExactFieldMatch       bool     `json:"exact_field_match" yaml:"exact_field_match"`
	EnableDefaultPatterns bool     `json:"enable_default_patterns" yaml:"enable_default_patterns"`
}

Desensitization holds desensitization settings

type Elasticsearch

type Elasticsearch struct {
	Addresses []string `json:"addresses" yaml:"addresses"`
	Username  string   `json:"username" yaml:"username"`
	Password  string   `json:"password" yaml:"password"`
}

Elasticsearch elasticsearch config struct

type Meilisearch

type Meilisearch struct {
	Host   string `json:"host" yaml:"host"`
	APIKey string `json:"api_key" yaml:"api_key"`
}

Meilisearch meilisearch config struct

type OpenSearch

type OpenSearch struct {
	Addresses       []string `json:"addresses" yaml:"addresses"`
	Username        string   `json:"username" yaml:"username"`
	Password        string   `json:"password" yaml:"password"`
	InsecureSkipTLS bool     `json:"insecure_skip_tls" yaml:"insecure_skip_tls"`
}

OpenSearch opensearch config struct

Jump to

Keyboard shortcuts

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