mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2024-12-23 12:09:47 +00:00
32 lines
517 B
Go
32 lines
517 B
Go
|
package config
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"strconv"
|
||
|
)
|
||
|
|
||
|
// DB holds the DB configuration
|
||
|
type DB struct {
|
||
|
Host string
|
||
|
Port int
|
||
|
Name string
|
||
|
User string
|
||
|
Password string
|
||
|
}
|
||
|
|
||
|
var db = &DB{}
|
||
|
|
||
|
// DBCfg returns the default DB configuration
|
||
|
func DBCfg() *DB {
|
||
|
return db
|
||
|
}
|
||
|
|
||
|
// LoadDBCfg loads DB configuration
|
||
|
func LoadDBCfg() {
|
||
|
db.Host = os.Getenv("DB_HOST")
|
||
|
db.Port, _ = strconv.Atoi(os.Getenv("DB_PORT"))
|
||
|
db.User = os.Getenv("DB_USER")
|
||
|
db.Password = os.Getenv("DB_PASSWORD")
|
||
|
db.Name = os.Getenv("DB_NAME")
|
||
|
}
|