config

package
v0.0.0-...-6f9a9ad Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCouldNotReadFile could not read file
	ErrCouldNotReadFile = errors.New("could not read file")
	// ErrMissingValue missing value
	ErrMissingValue = errors.New("missing value")
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Environment string `yaml:"environment" validate:"required" env:"APPCONFIG_ENVIRONMENT,required"`
	Port        string `yaml:"port" validate:"required" env:"APPCONFIG_PORT"`

	DatabaseConfig struct {
		DatabaseType string `yaml:"databaseType" validate:"required" env:"APPCONFIG_REPOSITORYCONFIG_DATABASETYPE,required"`
		Connection   string `yaml:"connection" validate:"required" env:"APPCONFIG_REPOSITORYCONFIG_CONNECTION,required"`
		DatabaseName string `yaml:"databaseName" validate:"required" env:"APPCONFIG_REPOSITORYCONFIG_DATABASENAME,required"`
	} `yaml:"databaseConfig"`
}

AppConfig defines the configuration

func GetConfig

func GetConfig(filename string) (*AppConfig, error)

GetConfig returns the application config to have

func GetConfigFromEnv

func GetConfigFromEnv() (*AppConfig, error)

GetConfigFromEnv returns the application config from environment set variables

Jump to

Keyboard shortcuts

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