config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix = "FAKE_SECRETS_"

	LogFormatJSON = "JSON"

	CommandHealthCheck = "healthcheck"
	CommandVersion     = "version"
	CommandServe       = "serve"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LogLevel      string        `env:"LOG_LEVEL"`
	LogFormat     string        `env:"LOG_FORMAT"`
	StorageDir    string        `env:"STORAGE_DIR"`
	PathPrefix    string        `env:"PATH_PREFIX"`
	ReadTimeout   time.Duration `env:"READ_TIMEOUT"`
	WriteTimeout  time.Duration `env:"WRITE_TIMEOUT"`
	ListenAddress string        `env:"LISTEN_ADDRESS"`
	ListenPort    int           `env:"LISTEN_PORT"`
	RandomSeed    int64         `env:"RANDOM_SEED"`

	Command string `env:"-"`
	// contains filtered or unexported fields
}

func New

func New(name string) *Config

func (*Config) HandlerPattern

func (c *Config) HandlerPattern(p ...string) string

func (*Config) Listen

func (c *Config) Listen() string

func (*Config) LoadArgs

func (c *Config) LoadArgs(args []string) (func(io.Writer), error)

func (*Config) LoadEnv

func (c *Config) LoadEnv() error

func (*Config) LogHandler

func (c *Config) LogHandler(w io.Writer) slog.Handler

func (*Config) LogVerbosity

func (c *Config) LogVerbosity() slog.Level

func (*Config) RandomGenerator

func (c *Config) RandomGenerator() *rand.Rand

func (*Config) RandomSeedTime

func (c *Config) RandomSeedTime() time.Time

func (*Config) RandomSource

func (c *Config) RandomSource() rand.Source

func (*Config) SelfURL

func (c *Config) SelfURL(api string) (*url.URL, error)

func (*Config) String

func (c *Config) String() string

Jump to

Keyboard shortcuts

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