config

package
v0.0.0-...-16cb402 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustInitDB

func MustInitDB(dataSourceName string) *sql.DB

MustInitDB inits DB connection

func MustMigrate

func MustMigrate(db *sql.DB) error

Types

type Config

type Config struct {
	Postgres   *Postgres `yaml:"postgres"`
	HTTP       *HTTP     `yaml:"http"`
	ServerName string    `yaml:"server_name"` // used for identity in zookeeper
}

Config ...

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

func Load

func Load(path string) (*Config, error)

Load yaml file path.

func MustLoad

func MustLoad(path string) *Config

MustLoad config file path.

type HTTP

type HTTP struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
}

HTTP represents config for serving files over HTTP

func DefaultHTTP

func DefaultHTTP() *HTTP

func (*HTTP) ConnectionURL

func (h *HTTP) ConnectionURL() string

type Postgres

type Postgres struct {
	Host            string `yaml:"host"`
	Port            int    `yaml:"port"`
	Username        string `yaml:"username"`
	Password        string `yaml:"password"`
	Database        string `yaml:"database"`
	SSLMode         string `yaml:"ssl_mode"`
	Timeout         int
	Protocol        string
	GoogleAuthFile  string
	MaxOpenConn     int
	MaxIdleConn     int
	ConnMaxLifeTime int
}

func DefaultPostgres

func DefaultPostgres() *Postgres

DefaultPostgres returns default Postgres object

func (*Postgres) ConnectionString

func (p *Postgres) ConnectionString() string

Jump to

Keyboard shortcuts

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