mirror of
https://github.com/cuigh/swirl
synced 2024-12-29 07:12:11 +00:00
59c8d6cf36
This is a breaking change if you used file config.
39 lines
632 B
Go
39 lines
632 B
Go
package misc
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/cuigh/auxo/config"
|
|
)
|
|
|
|
const (
|
|
// Version is the version of Swirl
|
|
Version = "0.6"
|
|
)
|
|
|
|
const (
|
|
envDockerEndpoint = "DOCKER_ENDPOINT"
|
|
envDBType = "DB_TYPE"
|
|
envDBAddress = "DB_ADDRESS"
|
|
)
|
|
|
|
var (
|
|
DockerHost string
|
|
DBType string
|
|
DBAddress string
|
|
)
|
|
|
|
func init() {
|
|
DockerHost = loadOption("swirl.docker_endpoint", envDockerEndpoint)
|
|
DBType = loadOption("swirl.db_type", envDBType)
|
|
DBAddress = loadOption("swirl.db_address", envDBAddress)
|
|
}
|
|
|
|
func loadOption(key, env string) (opt string) {
|
|
opt = config.GetString(key)
|
|
if opt == "" {
|
|
opt = os.Getenv(env)
|
|
}
|
|
return
|
|
}
|