config

package
v0.0.0-...-1f9399d Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	// LogLevel is INFO, DEBUG or ERROR.
	LogLevel string `default:"INFO"`

	// Port is the port number the API listen on.
	Port int16 `default:"3000"`

	// Token is the access token.
	Token string `required:"true"`
}

APIConfig represents the configuration of the application.

func LoadAPIConfigFromEnv

func LoadAPIConfigFromEnv() (*APIConfig, error)

LoadAPIConfigFromEnv loads the application configuration from environment variables.

type DBConfig

type DBConfig struct {
	// UserName is the user name of the database.
	UserName string `required:"true"`

	// Password is the database's password.
	Password string `required:"true"`

	// Host is the database's host.
	Host string `required:"true"`

	// Port is the port number the database listen on.
	Port int16 `required:"true"`

	// Name is the database name.
	Name string `required:"true"`

	// Protocol is the protocol of the connection.
	Protocol string `default:"tcp"`
}

DBConfig represents the database configuration.

func LoadDBConfigFromEnv

func LoadDBConfigFromEnv() (*DBConfig, error)

LoadDBConfigFromEnv loads the database configuration from environment variables.

func (*DBConfig) GetDataSourceName

func (c *DBConfig) GetDataSourceName() string

GetDataSourceName returns the driver-specific data source name.

Jump to

Keyboard shortcuts

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