Damnit again
Former-commit-id: b394f26caf0df7d113ac4cc7dacc9c544af6897f
This commit is contained in:
36
config/config.go
Normal file
36
config/config.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"local/storage"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var config Config
|
||||
var lock = &sync.RWMutex{}
|
||||
|
||||
type Config struct {
|
||||
db string
|
||||
DB storage.DB
|
||||
Port string
|
||||
Addr string
|
||||
Username string
|
||||
Password string
|
||||
DefaultNamespace string
|
||||
}
|
||||
|
||||
func Values() Config {
|
||||
lock.RLock()
|
||||
defer lock.RUnlock()
|
||||
return config
|
||||
}
|
||||
|
||||
func (c Config) String() string {
|
||||
return fmt.Sprintf(
|
||||
"port:%v db:%v addr:%v user:*** pass:*** ns:%s",
|
||||
c.Port,
|
||||
c.db,
|
||||
c.Addr,
|
||||
c.DefaultNamespace,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user