config

package
v0.0.0-...-fdd2a27 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigFilePath

func GetConfigFilePath() string

GetConfigFilePath returns the absolute path of the config file based on the current directory.

func GetLogLevel

func GetLogLevel(logLevel string) log.Level

GetLogLevel returns the slog log level based on a string representation of the log level. INFO is used as the default in case a level isn't given or is unexpected

func PathExists

func PathExists(path string) error

Types

type APIConfig

type APIConfig struct {
	Address string `mapstructure:"address"`
	Path    string `mapstructure:"path"`
	Env     string `mapstructure:"env"`
}

APIConfig holds the API configuration values

type Config

type Config struct {
	AudioDirectory string
	API            APIConfig      `mapstructure:"api"`
	Log            Log            `mapstructure:"log"`
	Database       DatabaseConfig `mapstructure:"database"`
}

Config holds the configuration values

func LoadConfig

func LoadConfig(file string) (*Config, error)

LoadConfig loads the configuration values from the specified file.

type Credentials

type Credentials struct {
	GetFromEnv  bool   `mapstructure:"envvar"`
	UserVar     string `mapstructure:"userVar"`
	PasswordVar string `mapstructure:"passwordVar"`

	User     string
	Password []byte
}

Credentials stores persistence layer-related credentials

func (*Credentials) GetCredentialsFromEnv

func (c *Credentials) GetCredentialsFromEnv()

GetCredentialsFromEnv will set the user and password values to envvar values

type DatabaseConfig

type DatabaseConfig struct {
	FileInfoConfig FileInformationStoreConfig `mapstructure:"file"`
	S3Config       S3Config                   `mapstructure:"s3"`
}

DatabaseConfig holds the database configuration values

type FileInformationStoreConfig

type FileInformationStoreConfig struct {
	Host        string      `mapstructure:"host"`
	Port        int         `mapstructure:"port"`
	Name        string      `mapstructure:"name"`
	SSL         SSL         `mapstructure:"ssl"`
	Credentials Credentials `mapstructure:"credentials"`
}

type Log

type Log struct {
	Level string `mapstructure:"level"`
}

Log holds the log configuration values

type S3Config

type S3Config struct {
	Bucket      string      `mapstructure:"bucket"`
	Region      string      `mapstructure:"region"`
	Endpoint    string      `mapstructure:"endpoint"`
	Retry       int         `mapstructure:"retry"`
	Timeout     int64       `mapstructure:"timeout"`
	SSL         SSL         `mapstructure:"ssl"`
	Credentials Credentials `mapstructure:"credentials"`
}

type SSL

type SSL struct {
	Enabled bool
}

SSL determines if SSL will be enabled for database connections

Jump to

Keyboard shortcuts

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