Update to fit new menuhandler signatures

This commit is contained in:
lash 2025-01-20 11:03:31 +00:00
parent 2f88d79394
commit 4cdd8a1082
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 20 additions and 16 deletions

View File

@ -23,25 +23,26 @@ var (
func main() {
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()
if connStr == "" {
connStr = config.DbConn()
}
connData, err := storage.ToConnData(connStr)
config.Apply(&override)
conns, err := config.GetConns()
if err != nil {
fmt.Fprintf(os.Stderr, "connstr err: %v", err)
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
os.Exit(1)
}
logg.Infof("start command", "conn", connData)
logg.Infof("start command", "conn", conns)
ctx := context.Background()
menuStorageService := storage.NewMenuStorageService(connData, "")
menuStorageService := storage.NewMenuStorageService(conns)
eu := viseevent.NewEventsUpdater(lookup.Api, menuStorageService)
eh := eu.ToEventsHandler()

View File

@ -3,12 +3,15 @@ package config
import (
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
"git.grassecon.net/grassrootseconomics/visedriver/env"
)
var (
JetstreamURL string
JetstreamClientName string
Apply = config.Apply
GetConns = config.GetConns
)
const (
@ -30,10 +33,10 @@ func LoadConfig() error {
return nil
}
func DbConn() string {
return viseconfig.DbConn
}
func Language() string {
return viseconfig.DefaultLanguage
}
func NewOverride() config.Override {
return config.Override{}
}

View File

@ -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 {
t.Fatal(err)
}

View File

@ -136,7 +136,7 @@ func TestTokenTransfer(t *testing.T) {
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 {
t.Fatal(err)
}
@ -246,7 +246,7 @@ func TestTokenMint(t *testing.T) {
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 {
t.Fatal(err)
}