config

package
v0.0.0-...-f3f7f80 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

config gets application configuration and creates service instances from environment variables

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHttpListenAddr

func GetHttpListenAddr() string

Get listen port for http server from environment variable HTTP_LISTEN_ADDR.

func GetHttpURL

func GetHttpURL(prefix string) (*url.URL, error)

Get URL for http endpoint from environment variable HTTP_URL.

func NewAliyunEmail

func NewAliyunEmail(prefix string) (*email.EmailService, error)

func NewElastic

func NewElastic(prefix string) (*elasticsearch.Client, error)

Creates an elasticsearch client from environment variables.

func NewMinio

func NewMinio(prefix string) (*minio.Client, error)

Creates an Amazon S3 compatible client from environment variables. The environment variables are ${prefix}ENDPOINT, ${prefix}ACCESS_KEY, ${prefix}SECRET_KEY. The prefix defaults to "S3_" if not specified.

func NewMySQL

func NewMySQL(prefix string) (*sql.DB, error)

Creates a *sql.DB instance from environment variables. The environment variables are: ${prefix}MYSQL_HOST, ${prefix}MYSQL_USER, ${prefix}MYSQL_PASSWORD, ${prefix}MYSQL_DATABASE.

func NewMySQLx

func NewMySQLx(prefix string) (*sqlx.DB, error)

Creates a *sqlx.DB instance from environment variables. The environment variables are: ${prefix}MYSQL_HOST, ${prefix}MYSQL_USER, ${prefix}MYSQL_PASSWORD, ${prefix}MYSQL_DATABASE.

func NewRedis

func NewRedis(prefix string) (*redis.Pool, error)

Creates a new *github.com/gomodule/redigo/redis.Pool instance from environment variables. The environment variable is ${prefix}REDIS_ADDR, in host:port format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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