config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"config",
	fx.Provide(New),
	fx.Provide(func(c Config) http.Config {
		return http.Config{
			Address:     c.Http.Address,
			ProxyHeader: c.Http.ProxyHeader,
			Proxies:     c.Http.Proxies,
		}
	}),
	fx.Provide(func(c Config) api.Config {
		return api.Config{
			CORSAllowOrigins: c.API.CORSAllowOrigins,
		}
	}),
	fx.Provide(func(c Config) redis.Config {
		return redis.Config{
			URL: c.Storage.URL,
		}
	}),
	fx.Provide(func(c Config) links.Config {
		return links.Config{
			Hostname: c.Links.Hostname,
			TTL:      c.Links.TTL,
		}
	}),
)

Functions

This section is empty.

Types

type APIConfig added in v0.4.0

type APIConfig struct {
	CORSAllowOrigins string `envconfig:"API__CORS_ALLOW_ORIGINS"`
}

type Config

type Config struct {
	Http    HttpConfig
	API     APIConfig
	Storage StorageConfig
	Links   LinksConfig
}

func New

func New() (Config, error)

type HttpConfig

type HttpConfig struct {
	Address     string   `envconfig:"HTTP__ADDRESS"`
	ProxyHeader string   `envconfig:"HTTP__PROXY_HEADER"`
	Proxies     []string `envconfig:"HTTP__PROXIES"`
}

type LinksConfig

type LinksConfig struct {
	Hostname string        `envconfig:"LINKS__HOSTNAME"`
	TTL      time.Duration `envconfig:"LINKS__TTL"`
}

type StorageConfig

type StorageConfig struct {
	URL string `envconfig:"STORAGE__URL"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳