Documentation ¶
Overview ¶
config gets application configuration and creates service instances from environment variables
Index ¶
- func GetHttpListenAddr() string
- func GetHttpURL(prefix string) (*url.URL, error)
- func NewAliyunEmail(prefix string) (*email.EmailService, error)
- func NewElastic(prefix string) (*elasticsearch.Client, error)
- func NewMinio(prefix string) (*minio.Client, error)
- func NewMySQL(prefix string) (*sql.DB, error)
- func NewMySQLx(prefix string) (*sqlx.DB, error)
- func NewRedis(prefix string) (*redis.Pool, error)
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 ¶
Get URL for http endpoint from environment variable HTTP_URL.
func NewAliyunEmail ¶
func NewAliyunEmail(prefix string) (*email.EmailService, error)
func NewElastic ¶
Creates an elasticsearch client from environment variables.
func NewMinio ¶
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 ¶
Creates a *sql.DB instance from environment variables. The environment variables are: ${prefix}MYSQL_HOST, ${prefix}MYSQL_USER, ${prefix}MYSQL_PASSWORD, ${prefix}MYSQL_DATABASE.
Types ¶
This section is empty.