swirl/misc/misc.go

33 lines
736 B
Go
Raw Normal View History

2017-09-26 12:50:09 +00:00
package misc
import (
"github.com/cuigh/auxo/config"
)
const (
2017-10-27 12:31:30 +00:00
keyDockerEndpoint = "swirl.docker_endpoint"
keyDBType = "swirl.db_type"
keyDBAddress = "swirl.db_address"
2017-09-26 12:50:09 +00:00
envDockerEndpoint = "DOCKER_ENDPOINT"
envDBType = "DB_TYPE"
envDBAddress = "DB_ADDRESS"
)
2017-10-27 12:31:30 +00:00
var Options = &struct {
DockerEndpoint string
DBType string
DBAddress string
}{}
2017-09-26 12:50:09 +00:00
2017-10-27 12:31:30 +00:00
func BindOptions() {
config.BindEnv(keyDockerEndpoint, envDockerEndpoint)
config.BindEnv(keyDBType, envDBType)
config.BindEnv(keyDBAddress, envDBAddress)
2017-09-26 12:50:09 +00:00
}
2017-10-27 12:31:30 +00:00
func LoadOptions() {
Options.DockerEndpoint = config.GetString(keyDockerEndpoint)
Options.DBType = config.GetString(keyDBType)
Options.DBAddress = config.GetString(keyDBAddress)
2017-09-26 12:50:09 +00:00
}