config

package
v0.0.0-...-262e94b Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPort is default HTTP app port.
	DefaultPort = "31001"
	// EnvPath is .env file path.
	EnvPath = "../../config/config.env"
	// EnvPrefix is environment
	EnvPrefix = "PS"
	// DefaultMaxIdleConn is default max db idle connection.
	DefaultMaxIdleConn = 10
	// DefaultMaxOpenConn is default max db open connection.
	DefaultMaxOpenConn = 10
	// DefaultConnMaxLifeTime is default db connection max life time.
	DefaultConnMaxLifeTime = 5 * time.Minute
	// RabbitMQName is rabbitmq queue name.
	RabbitMQName = "POINT_SYSTEM_QUEUE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// HTTP port.
	Port string

	// Database ip and port.
	Address string
	// Database name.
	DB string
	// Database schema name.
	Schema string
	// Database username.
	User string
	// Database password.
	Password string

	// RabbitMQ URL connection.
	RabbitmqUrl string `split_words:"true"`
}

Config is config model for app.

func GetConfig

func GetConfig() (cfg Config)

GetConfig to get config from env.

func (*Config) InitDB

func (c *Config) InitDB() (db *gorm.DB, err error)

InitDB to intiate db connection.

func (*Config) InitRabbit

func (c *Config) InitRabbit() (ch *amqp.Channel, err error)

InitRabbit to intiate rabbitmq connection.

Jump to

Keyboard shortcuts

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