Update to fit new menuhandler signatures
This commit is contained in:
parent
2f88d79394
commit
4cdd8a1082
19
cmd/main.go
19
cmd/main.go
@ -23,25 +23,26 @@ var (
|
|||||||
func main() {
|
func main() {
|
||||||
config.LoadConfig()
|
config.LoadConfig()
|
||||||
|
|
||||||
var connStr string
|
override := config.NewOverride()
|
||||||
|
|
||||||
flag.StringVar(&connStr, "c", "", "connection string")
|
flag.StringVar(override.DbConn, "c", "?", "default connection string (replaces all unspecified strings)")
|
||||||
|
flag.StringVar(override.ResourceConn, "resource", "?", "resource connection string")
|
||||||
|
flag.StringVar(override.UserConn, "userdata", "?", "userdata store connection string")
|
||||||
|
flag.StringVar(override.StateConn, "state", "?", "state store connection string")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if connStr == "" {
|
config.Apply(&override)
|
||||||
connStr = config.DbConn()
|
conns, err := config.GetConns()
|
||||||
}
|
|
||||||
connData, err := storage.ToConnData(connStr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "connstr err: %v", err)
|
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
logg.Infof("start command", "conn", connData)
|
logg.Infof("start command", "conn", conns)
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
menuStorageService := storage.NewMenuStorageService(connData, "")
|
menuStorageService := storage.NewMenuStorageService(conns)
|
||||||
|
|
||||||
eu := viseevent.NewEventsUpdater(lookup.Api, menuStorageService)
|
eu := viseevent.NewEventsUpdater(lookup.Api, menuStorageService)
|
||||||
eh := eu.ToEventsHandler()
|
eh := eu.ToEventsHandler()
|
||||||
|
@ -3,12 +3,15 @@ package config
|
|||||||
import (
|
import (
|
||||||
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
|
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
|
||||||
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
|
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
|
||||||
|
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
JetstreamURL string
|
JetstreamURL string
|
||||||
JetstreamClientName string
|
JetstreamClientName string
|
||||||
|
Apply = config.Apply
|
||||||
|
GetConns = config.GetConns
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -30,10 +33,10 @@ func LoadConfig() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func DbConn() string {
|
|
||||||
return viseconfig.DbConn
|
|
||||||
}
|
|
||||||
|
|
||||||
func Language() string {
|
func Language() string {
|
||||||
return viseconfig.DefaultLanguage
|
return viseconfig.DefaultLanguage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewOverride() config.Override {
|
||||||
|
return config.Override{}
|
||||||
|
}
|
||||||
|
@ -197,7 +197,7 @@ func TestHandleMsg(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mh, err := application.NewMenuHandlers(nil, userStore, nil, nil, testutil.ReplaceSeparatorFunc)
|
mh, err := application.NewMenuHandlers(nil, userStore, nil, testutil.ReplaceSeparatorFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ func TestTokenTransfer(t *testing.T) {
|
|||||||
t.Fatal("no transaction data")
|
t.Fatal("no transaction data")
|
||||||
}
|
}
|
||||||
|
|
||||||
mh, err := application.NewMenuHandlers(nil, userStore, nil, nil, testutil.ReplaceSeparatorFunc)
|
mh, err := application.NewMenuHandlers(nil, userStore, nil, testutil.ReplaceSeparatorFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ func TestTokenMint(t *testing.T) {
|
|||||||
t.Fatal("no transaction data")
|
t.Fatal("no transaction data")
|
||||||
}
|
}
|
||||||
|
|
||||||
mh, err := application.NewMenuHandlers(nil, userStore, nil, nil, testutil.ReplaceSeparatorFunc)
|
mh, err := application.NewMenuHandlers(nil, userStore, nil, testutil.ReplaceSeparatorFunc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user