configuration

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: Apache-2.0 Imports: 7 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 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
	}),
)

Functions

This section is empty.

Types

type Config

type Config struct {
	APIProd  bool
	APILocal bool `default:"true"`
	APIHTTP  HTTPConfig
}

type HTTPConfig

type HTTPConfig struct {
	Addr           string        `default:":9090"`
	HandlerTimeout time.Duration `default:"30s"`
	ReadTimeout    time.Duration `default:"15s"`
	WriteTimeout   time.Duration `default:"15s"`
	IdleTimeout    time.Duration `default:"15s"`
}

Jump to

Keyboard shortcuts

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