config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagLogLevel  = "log-level"
	FlagLogFormat = "log-format"

	FlagRedisHost     = "redis-host"
	FlagRedisPort     = "redis-port"
	FlagRedisPassword = "redis-password"
	FlagRedisDB       = "redis-db"

	FlagHTTPTimeout  = "http-timeout"
	FlagUpdatesAddr  = "updates-addr"
	FlagUpdatesHost  = "updates-host"
	FlagDownloadAddr = "download-addr"
	FlagDownloadHost = "download-host"

	FlagAccountID  = "account-id"
	FlagLicenseKey = "license-key"

	FlagCacheDuration = "cache-duration"

	FlagDebugAddr = "debug-addr"

	FlagTranslateIngressNginxUrls = "translate-ingress-nginx-urls"
)
View Source
const EnvPrefix = "GEOIP_"

Variables

This section is empty.

Functions

func EnvName

func EnvName(name string) string

func InitLog

func InitLog(w io.Writer, level slogx.Level, format slogx.Format)

func NewContext

func NewContext(ctx context.Context, conf *Config) context.Context

func RegisterCompletions

func RegisterCompletions(cmd *cobra.Command)

Types

type Config

type Config struct {
	RedisHost     string
	RedisPort     uint16
	RedisPassword string
	RedisDB       int

	HTTPTimeout  time.Duration
	UpdatesAddr  string
	UpdatesHost  string
	DownloadAddr string
	DownloadHost string

	AccountID  int
	LicenseKey string

	CacheDuration time.Duration

	DebugAddr string

	TranslateIngressNginxPaths bool
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) (*Config, bool)

func NewDefault

func NewDefault() *Config

func (*Config) InitLog

func (c *Config) InitLog(w io.Writer)

func (*Config) Load

func (c *Config) Load(cmd *cobra.Command) error

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(cmd *cobra.Command)

Jump to

Keyboard shortcuts

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