2017-09-26 12:50:09 +00:00
|
|
|
package misc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/cuigh/auxo/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// Version is the version of Swirl
|
2017-10-26 09:05:27 +00:00
|
|
|
Version = "0.6"
|
2017-09-26 12:50:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
envDockerEndpoint = "DOCKER_ENDPOINT"
|
|
|
|
envDBType = "DB_TYPE"
|
|
|
|
envDBAddress = "DB_ADDRESS"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
DockerHost string
|
|
|
|
DBType string
|
|
|
|
DBAddress string
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2017-10-26 09:05:27 +00:00
|
|
|
DockerHost = loadOption("swirl.docker_endpoint", envDockerEndpoint)
|
|
|
|
DBType = loadOption("swirl.db_type", envDBType)
|
|
|
|
DBAddress = loadOption("swirl.db_address", envDBAddress)
|
2017-09-26 12:50:09 +00:00
|
|
|
}
|
|
|
|
|
2017-10-26 09:05:27 +00:00
|
|
|
func loadOption(key, env string) (opt string) {
|
|
|
|
opt = config.GetString(key)
|
2017-09-26 12:50:09 +00:00
|
|
|
if opt == "" {
|
|
|
|
opt = os.Getenv(env)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|