settings_utils

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Refreshed = make(chan struct{}, 10)

nolint: gochecknoglobals, mnd // required

View Source
var ServiceSettings = MustGetSetting[serviceSettings](context.Background(), "SERVICE_")

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_",
		  	  "TG.Token",
		  ))
	 }

	 var Settings serviceSettings

Panics 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