monitor a good
Former-commit-id: 5a37bfdfe208d3d1a71e6b4924209d0c8e6f53a0
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"local/storage"
|
||||
"sync"
|
||||
@@ -17,6 +18,8 @@ type Config struct {
|
||||
Username string
|
||||
Password string
|
||||
DefaultNamespace string
|
||||
Ctx context.Context
|
||||
Can context.CancelFunc
|
||||
}
|
||||
|
||||
func Values() Config {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"local/args"
|
||||
"local/storage"
|
||||
"os"
|
||||
@@ -17,6 +18,7 @@ func New() error {
|
||||
if err := as.Parse(); err != nil {
|
||||
return err
|
||||
}
|
||||
ctx, can := context.WithCancel(context.Background())
|
||||
config = Config{
|
||||
db: as.Get("db").GetString(),
|
||||
Addr: as.Get("addr").GetString(),
|
||||
@@ -24,6 +26,8 @@ func New() error {
|
||||
Password: as.Get("pass").GetString(),
|
||||
Port: as.Get("port").GetString(),
|
||||
DefaultNamespace: as.Get("ns").GetString(),
|
||||
Ctx: ctx,
|
||||
Can: can,
|
||||
}
|
||||
storage.DefaultNamespace = config.DefaultNamespace
|
||||
DB, err := storage.New(storage.TypeFromString(config.db), config.Addr, config.Username, config.Password)
|
||||
|
||||
Reference in New Issue
Block a user