config

package
v0.40.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MPL-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package config package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger        *log.Logger
	TokenProvider auth.TokenProvider
	Endpoint      string
}

Config holds a configuration.

func Load

func Load(optFns ...func(*LoadOptions) error) (*Config, error)

Load loads a configuration from a file and/or environment variables.

func (Config) Validate

func (c Config) Validate() error

Validate validates a config.

type LoadOptions

type LoadOptions struct {
	Logger        *log.Logger
	TokenProvider auth.TokenProvider
	Endpoint      string
}

LoadOptions holds the options for loading a configuration.

type LoadOptionsFunc

type LoadOptionsFunc func(*LoadOptions) error

LoadOptionsFunc is a type alias for the type of function that adds a load option.

func WithEndpoint

func WithEndpoint(endpoint string) LoadOptionsFunc

WithEndpoint add/sets the specified endpoint, replacing THARSIS_ENDPOINT

func WithLogger

func WithLogger(v *log.Logger) LoadOptionsFunc

WithLogger adds the specified logger.

func WithTokenProvider

func WithTokenProvider(v auth.TokenProvider) LoadOptionsFunc

WithTokenProvider adds the specified authentication provider.

Jump to

Keyboard shortcuts

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