config

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EnvironmentVariablePrefix = "MODM"

Variables

This section is empty.

Functions

func GetValue

func GetValue(i any) reflect.Value

func LoadConfiguration

func LoadConfiguration(path string, name *string, root any) error

Loads a configuration instance using values from .env and from environment variables

Types

type AppConfig

type AppConfig struct {
	Azure             AzureSettings
	Database          DatabaseSettings
	Http              HttpSettings
	Logging           LoggingSettings
	Environment       string `mapstructure:"GO_ENV"`
	ReadinessFilePath string `mapstructure:"READINESS_FILE_PATH"`
}

func (*AppConfig) GetDatabaseOptions

func (c *AppConfig) GetDatabaseOptions() *data.DatabaseOptions

func (*AppConfig) GetLoggingOptions

func (c *AppConfig) GetLoggingOptions(label string) *log.LoggingOptions

func (*AppConfig) GetPublicBaseUrl

func (s *AppConfig) GetPublicBaseUrl() *url.URL

func (*AppConfig) GetReadinessFilePath

func (c *AppConfig) GetReadinessFilePath() string

func (*AppConfig) IsDevelopment

func (c *AppConfig) IsDevelopment() bool

type AzureSettings

type AzureSettings struct {
	ClientId            string `mapstructure:"AZURE_CLIENT_ID"`
	TenantId            string `mapstructure:"AZURE_TENANT_ID"`
	SubscriptionId      string `mapstructure:"AZURE_SUBSCRIPTION_ID"`
	ResourceGroupName   string `mapstructure:"AZURE_RESOURCE_GROUP"`
	Location            string `mapstructure:"AZURE_LOCATION"`
	ServiceBusNamespace string `mapstructure:"AZURE_SERVICEBUS_NAMESPACE"`
}

The azure settings

func (*AzureSettings) GetFullQualifiedNamespace

func (s *AzureSettings) GetFullQualifiedNamespace() string

func (*AzureSettings) GetResourceGroupId

func (s *AzureSettings) GetResourceGroupId() string

type DatabaseSettings

type DatabaseSettings struct {
	Path        string `mapstructure:"DB_PATH"`
	UseInMemory bool   `mapstructure:"DB_USE_INMEMEORY"`
}

The database settings

type HttpSettings

type HttpSettings struct {
	BaseUrl string `mapstructure:"PUBLIC_BASE_URL"`
	Port    string `mapstructure:"PUBLIC_PORT"`
}

type LoggingSettings

type LoggingSettings struct {
	DefaultLogLevel string `mapstructure:"LOG_LEVEL"`
	FilePath        string `mapstructure:"LOG_FILE_PATH"`
}

Jump to

Keyboard shortcuts

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