You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
582 B
31 lines
582 B
package config
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
)
|
|
|
|
var MySqlHost = strEnv("LUCIFER_MYSQL_HOST")
|
|
var MySqlPort = intEnv("LUCIFER_MYSQL_PORT")
|
|
var MySqlUsername = strEnv("LUCIFER_MYSQL_USERNAME")
|
|
var MySQlPassword = strEnv("LUCIFER_MYSQL_PASSWORD")
|
|
|
|
var ServerPort = intEnv("LUCIFER_SERVER_PORT")
|
|
|
|
func strEnv(key string) string {
|
|
env, ok := os.LookupEnv(key)
|
|
if !ok {
|
|
panic("missing environment variable: " + key)
|
|
}
|
|
|
|
return env
|
|
}
|
|
|
|
func intEnv(key string) int {
|
|
val, err := strconv.Atoi(strEnv(key))
|
|
if err != nil {
|
|
panic("invalid environment variable: " + key)
|
|
}
|
|
|
|
return val
|
|
}
|