monitor a good

Former-commit-id: 5a37bfdfe208d3d1a71e6b4924209d0c8e6f53a0
This commit is contained in:
bel
2019-06-21 21:59:56 -06:00
parent 90a31495c9
commit 730cf1e15a
32 changed files with 542 additions and 2983 deletions

View File

@@ -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 {

View File

@@ -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)