config

package
v0.0.0-...-9a2df54 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Load     = config.MustLoad
	MustLoad = config.MustLoad
)

Functions

This section is empty.

Types

type Config

type Config struct {
	App struct {
		Name     string `toml:"Name" env:"APP_NAME" env-default:"Auth"`
		Address  string `toml:"Address" env:"APP_ADDRESS" env-default:"0.0.0.0:3000"`
		LogLevel string `toml:"LogLevel" env:"APP_LOG_LEVEL" env-default:"debug"`
	} `toml:"App"`

	DB struct {
		PoolMax              int    `toml:"PoolMax" env:"DB_POOL_MAX" env-default:"1"`
		URL                  string `toml:"URL" env:"DB_URL" env-default:"file::memory:?cache=shared"`
		Driver               string `toml:"Driver" env:"DB_DRIVER" env-default:"sqliteshim"`
		PrintQueriesToStdout bool   `toml:"PrintQueriesToStdout" env:"DB_PRINT_TO_STDOUT"  env-default:"true"`
	} `toml:"DB"`

	Redis struct {
		URL       string `toml:"URL" env:"REDIS_URI" env-default:".." `
		EnableTLS bool   `toml:"EnableTLS" env:"REDIS_ENABLE_TLS" env-default:"true"`
	} `toml:"Redis"`
}

func InitialiseSetup

func InitialiseSetup(configFile *string, ctx context.Context,
) (
	*Config,
	*logger.SlogLogger,
	*bun.DB,
	*fiber.App,
)

InitialiseSetup initiates all required data types to use through out program cycle. i deliberately refused placing it in a struct so everything is expressed in case of any changes made, as struct could hide some uninstantiated values. placing it here way makes it easy to set up go tests.

Jump to

Keyboard shortcuts

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