settings_utils

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServiceSettings serviceSettings

Functions

func GetSettings

func GetSettings[T any](ctx context.Context, envPrefix string) (T, error)

GetSettings Initialize settings, example:

 type tg struct {
   Token string `env:"TOKEN,required"`
 }

 type serviceSettings struct {
	TG  tg  `env:"TG" envPrefix:"TG__"`
 }

 func init() {
	  ctx := logger_utils.NewLoggedCtx()

	  Settings = must_utils.Must(settings_utils.InitSetting[serviceSettings](ctx, "TEAS_"))
 }

 var Settings serviceSettings

Returns error if dotEnv file found, but corrupted.

func MustGetSetting

func MustGetSetting[T any](ctx context.Context, envPrefix string) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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