configuration

package
v0.0.0-...-eb43240 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Options(
	fx.Provide(
		func() (*Config, error) {
			var cfg Config

			if envutils.GetEnvBoolWithDefault("API_LOCAL", false) {
				if err := godotenv.Load(); err != nil {
					return nil, err
				}
			}

			if err := configor.New(&configor.Config{ErrorOnUnmatchedKeys: true}).Load(&cfg, "cmd/api/configuration/default.json"); err != nil {
				return nil, err
			}

			return &cfg, nil
		},
		func(cfg *Config) *httpserver.Config { return cfg.APIHTTP },
		func(cfg *Config) *fxpostgres.Config { return cfg.APIDataStore },
		func(cfg *Config) *fxlogger.Config { return cfg.APILogger },
		func(cfg *Config) *fxrf.Config { return cfg.APIResponseFactory },
		func(cfg *Config) *smtp.SenderConfig { return cfg.APISMTPSender },
	),
)

Functions

This section is empty.

Types

type Config

type Config struct {
	APILocal           bool `default:"true"`
	APILogger          *fxlogger.Config
	APIHTTP            *httpserver.Config
	APIDataStore       *fxpostgres.Config
	APIResponseFactory *fxrf.Config
	APISMTPSender      *smtp.SenderConfig
}

Jump to

Keyboard shortcuts

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