config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDBToolConfig

func GetDBToolConfig(cfg PostgresConfig) dbtool.Config

Types

type AppConfig

type AppConfig struct {
	Address string `envconfig:"ADDRESS" default:":8089" required:"true"`
}

AppConfig contain applicatoin configuration

func GetAppConfig

func GetAppConfig(cfg Config) AppConfig

type Config

type Config struct {
	App AppConfig
	Pg  PostgresConfig
}

func LoadConfig

func LoadConfig() (cfg Config, err error)

type PostgresConfig

type PostgresConfig struct {
	dbtool.Config

	DbName       string `required:"true" default:"typical-rest-server"`
	User         string `required:"true" default:"default_user"`
	Password     string `required:"true" default:"default_password"`
	Host         string `default:"localhost"`
	Port         int    `default:"5432"`
	MigrationSrc string `default:"scripts/migration"`
}

PostgresConfig contain postgres database configuration

func GetPgConfig

func GetPgConfig(cfg Config) PostgresConfig

func (*PostgresConfig) AdminDataSource

func (c *PostgresConfig) AdminDataSource() string

AdminDataSource return connection string for adminitration script

func (*PostgresConfig) DataSource

func (c *PostgresConfig) DataSource() string

DataSource return connection string

func (*PostgresConfig) DatabaseName

func (c *PostgresConfig) DatabaseName() string

DatabaseName return the database name

func (*PostgresConfig) DriverName

func (c *PostgresConfig) DriverName() string

DriverName return the driver name

func (*PostgresConfig) MigrationSource

func (c *PostgresConfig) MigrationSource() string

MigrationSource return the migration source

Jump to

Keyboard shortcuts

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