settings_utils

package
v0.1.54 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseSettings = MustGetSetting[baseSettings](context.Background(), "BASE_")
View Source
var Refreshed = make(chan struct{}, 10)

nolint: gochecknoglobals, mnd // required

Functions

func GetSettings added in v0.1.49

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

GetSettings Initialize settings, example:

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

	 type baseSettings struct {
		TG  tg  `env:"TG" envPrefix:"TG__"`
	 }
	 func init() {
		  ctx := logger_utils.NewLoggedCtx()

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

	 var Settings baseSettings

Panics if dotEnv file found, but corrupted.

func MustGetSetting added in v0.1.49

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