fxconfig

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FxConfig = fx.Module(
	"fxconfig",
	fx.Provide(
		NewConfig,
		NewConfigAccessor,
	),
)

Functions

func GetEnv

func GetEnv(key string) string

GetEnv is still available for direct env access

Types

type Accessor

type Accessor struct{}

Accessor provides Yokai-style config access e.g., fxConfig.Config().String("app.name")

func ConfigAccessor

func ConfigAccessor() *Accessor

ConfigAccessor returns the global config accessor, Yokai-style

func NewConfigAccessor

func NewConfigAccessor() *Accessor

NewConfigAccessor returns the config accessor for DI

func (*Accessor) AllSettings

func (a *Accessor) AllSettings() map[string]interface{}

func (*Accessor) Bool

func (a *Accessor) Bool(key string) bool

func (*Accessor) Float64

func (a *Accessor) Float64(key string) float64

func (*Accessor) Int

func (a *Accessor) Int(key string) int

func (*Accessor) String

func (a *Accessor) String(key string) string

type Config

type Config struct {
	App struct {
		Name string `mapstructure:"name"`
		Port string `mapstructure:"port"`
	} `mapstructure:"app"`
	Database struct {
		Host     string `mapstructure:"host"`
		Port     int    `mapstructure:"port"`
		User     string `mapstructure:"user"`
		Password string `mapstructure:"password"`
		DBName   string `mapstructure:"dbname"`
		SSLMode  string `mapstructure:"sslmode"`
	} `mapstructure:"database"`
	Accessor *Accessor
}

func NewConfig

func NewConfig() (*Config, error)

func (*Config) PostgresDSN

func (c *Config) PostgresDSN() string

Jump to

Keyboard shortcuts

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