Compare commits
No commits in common. "44846c59508fbfc7c7c5589b9c2036d39de18b62" and "7d513ac2a757f022078a6d5a676acc81de27ef7a" have entirely different histories.
44846c5950
...
7d513ac2a7
@ -36,7 +36,8 @@ var (
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
var override config.Override
|
||||
var connStr string
|
||||
var resourceDir string
|
||||
var size uint
|
||||
var engineDebug bool
|
||||
var host string
|
||||
@ -45,11 +46,10 @@ func main() {
|
||||
var gettextDir string
|
||||
var langs args.LangVar
|
||||
|
||||
|
||||
flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir")
|
||||
flag.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
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.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&host, "h", config.Host(), "http host")
|
||||
flag.UintVar(&port, "p", config.Port(), "http port")
|
||||
@ -57,14 +57,16 @@ func main() {
|
||||
flag.Var(&langs, "language", "add symbol resolution for language")
|
||||
flag.Parse()
|
||||
|
||||
config.Apply(&override)
|
||||
conns, err := config.GetConns()
|
||||
if connStr == "" {
|
||||
connStr = config.DbConn()
|
||||
}
|
||||
connData, err := storage.ToConnData(connStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "connstr err: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logg.Infof("start command", "build", build, "conn", conns, "outputsize", size)
|
||||
logg.Infof("start command", "build", build, "conn", connData, "resourcedir", resourceDir, "outputsize", size)
|
||||
|
||||
ctx := context.Background()
|
||||
ln, err := lang.LanguageFromCode(config.Language())
|
||||
@ -87,7 +89,7 @@ func main() {
|
||||
cfg.EngineDebug = true
|
||||
}
|
||||
|
||||
menuStorageService := storage.NewMenuStorageService(conns)
|
||||
menuStorageService := storage.NewMenuStorageService(connData, resourceDir)
|
||||
rs, err := menuStorageService.GetResource(ctx)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "menustorageservice: %v\n", err)
|
||||
@ -99,6 +101,7 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, "userdatadb: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer userdataStore.Close()
|
||||
|
||||
dbResource, ok := rs.(*resource.DbResource)
|
||||
if !ok {
|
||||
@ -117,7 +120,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
accountService := services.New(ctx, menuStorageService)
|
||||
accountService := services.New(ctx, menuStorageService, connData)
|
||||
|
||||
hl, err := lhs.GetHandler(accountService)
|
||||
if err != nil {
|
||||
@ -130,6 +133,7 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, "getstatestore: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer stateStore.Close()
|
||||
|
||||
rp := &at.ATRequestParser{}
|
||||
bsh := request.NewBaseRequestHandler(cfg, rs, stateStore, userdataStore, rp, hl)
|
||||
@ -142,10 +146,7 @@ func main() {
|
||||
Addr: fmt.Sprintf("%s:%s", host, strconv.Itoa(int(port))),
|
||||
Handler: mux,
|
||||
}
|
||||
shutdownFunc := func() {
|
||||
sh.Shutdown(ctx)
|
||||
}
|
||||
s.RegisterOnShutdown(shutdownFunc)
|
||||
s.RegisterOnShutdown(sh.Shutdown)
|
||||
|
||||
cint := make(chan os.Signal)
|
||||
cterm := make(chan os.Signal)
|
||||
|
@ -44,8 +44,9 @@ func (p *asyncRequestParser) GetInput(r any) ([]byte, error) {
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
var override config.Override
|
||||
var connStr string
|
||||
var sessionId string
|
||||
var resourceDir string
|
||||
var size uint
|
||||
var engineDebug bool
|
||||
var host string
|
||||
@ -55,11 +56,8 @@ func main() {
|
||||
var langs args.LangVar
|
||||
|
||||
flag.StringVar(&sessionId, "session-id", "075xx2123", "session id")
|
||||
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.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir")
|
||||
flag.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&host, "h", config.Host(), "http host")
|
||||
@ -68,14 +66,16 @@ func main() {
|
||||
flag.Var(&langs, "language", "add symbol resolution for language")
|
||||
flag.Parse()
|
||||
|
||||
config.Apply(&override)
|
||||
conns, err := config.GetConns()
|
||||
if connStr == "" {
|
||||
connStr = config.DbConn()
|
||||
}
|
||||
connData, err := storage.ToConnData(connStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "connstr err: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logg.Infof("start command", "conn", conns, "outputsize", size, "sessionId", sessionId)
|
||||
logg.Infof("start command", "conn", connData, "resourcedir", resourceDir, "outputsize", size, "sessionId", sessionId)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@ -99,7 +99,7 @@ func main() {
|
||||
cfg.EngineDebug = true
|
||||
}
|
||||
|
||||
menuStorageService := storage.NewMenuStorageService(conns)
|
||||
menuStorageService := storage.NewMenuStorageService(connData, resourceDir)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
@ -116,7 +116,7 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
//defer userdataStore.Close(ctx)
|
||||
defer userdataStore.Close()
|
||||
|
||||
dbResource, ok := rs.(*resource.DbResource)
|
||||
if !ok {
|
||||
@ -126,7 +126,7 @@ func main() {
|
||||
lhs, err := handlers.NewLocalHandlerService(ctx, pfp, true, dbResource, cfg, rs)
|
||||
lhs.SetDataStore(&userdataStore)
|
||||
|
||||
accountService := services.New(ctx, menuStorageService)
|
||||
accountService := services.New(ctx, menuStorageService, connData)
|
||||
|
||||
hl, err := lhs.GetHandler(accountService)
|
||||
if err != nil {
|
||||
@ -139,7 +139,7 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
//defer stateStore.Close(ctx)
|
||||
defer stateStore.Close()
|
||||
|
||||
rp := &asyncRequestParser{
|
||||
sessionId: sessionId,
|
||||
@ -161,7 +161,7 @@ func main() {
|
||||
case _ = <-cint:
|
||||
case _ = <-cterm:
|
||||
}
|
||||
sh.Shutdown(ctx)
|
||||
sh.Shutdown()
|
||||
}()
|
||||
|
||||
for true {
|
||||
@ -177,7 +177,7 @@ func main() {
|
||||
fmt.Errorf("error in output: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
rqs, err = sh.Reset(ctx, rqs)
|
||||
rqs, err = sh.Reset(rqs)
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "error in reset: %v", "err", err)
|
||||
fmt.Errorf("error in reset: %v", err)
|
||||
|
@ -35,7 +35,8 @@ var (
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
var override config.Override
|
||||
var connStr string
|
||||
var resourceDir string
|
||||
var size uint
|
||||
var engineDebug bool
|
||||
var host string
|
||||
@ -44,11 +45,8 @@ func main() {
|
||||
var gettextDir string
|
||||
var langs args.LangVar
|
||||
|
||||
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.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir")
|
||||
flag.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&host, "h", config.Host(), "http host")
|
||||
@ -57,14 +55,16 @@ func main() {
|
||||
flag.Var(&langs, "language", "add symbol resolution for language")
|
||||
flag.Parse()
|
||||
|
||||
config.Apply(&override)
|
||||
conns, err := config.GetConns()
|
||||
if connStr == "" {
|
||||
connStr = config.DbConn()
|
||||
}
|
||||
connData, err := storage.ToConnData(connStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "connstr err: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logg.Infof("start command", "conn", conns, "outputsize", size)
|
||||
logg.Infof("start command", "conn", connData, "resourcedir", resourceDir, "outputsize", size)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@ -88,7 +88,7 @@ func main() {
|
||||
cfg.EngineDebug = true
|
||||
}
|
||||
|
||||
menuStorageService := storage.NewMenuStorageService(conns)
|
||||
menuStorageService := storage.NewMenuStorageService(connData, resourceDir)
|
||||
|
||||
rs, err := menuStorageService.GetResource(ctx)
|
||||
if err != nil {
|
||||
@ -101,6 +101,7 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
defer userdataStore.Close()
|
||||
|
||||
dbResource, ok := rs.(*resource.DbResource)
|
||||
if !ok {
|
||||
@ -115,7 +116,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
accountService := services.New(ctx, menuStorageService)
|
||||
accountService := services.New(ctx, menuStorageService, connData)
|
||||
|
||||
hl, err := lhs.GetHandler(accountService)
|
||||
if err != nil {
|
||||
@ -128,6 +129,7 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
defer stateStore.Close()
|
||||
|
||||
//accountService := services.New(ctx, menuStorageService, connData)
|
||||
|
||||
@ -138,10 +140,7 @@ func main() {
|
||||
Addr: fmt.Sprintf("%s:%s", host, strconv.Itoa(int(port))),
|
||||
Handler: sh,
|
||||
}
|
||||
shutdownFunc := func() {
|
||||
sh.Shutdown(ctx)
|
||||
}
|
||||
s.RegisterOnShutdown(shutdownFunc)
|
||||
s.RegisterOnShutdown(sh.Shutdown)
|
||||
|
||||
cint := make(chan os.Signal)
|
||||
cterm := make(chan os.Signal)
|
||||
|
37
cmd/main.go
37
cmd/main.go
@ -5,9 +5,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"syscall"
|
||||
|
||||
"git.defalsify.org/vise.git/engine"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
@ -29,33 +27,34 @@ var (
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
var override config.Override
|
||||
var connStr string
|
||||
var size uint
|
||||
var sessionId string
|
||||
var engineDebug bool
|
||||
var resourceDir string
|
||||
var err error
|
||||
var gettextDir string
|
||||
var langs args.LangVar
|
||||
|
||||
flag.StringVar(&resourceDir, "resourcedir", scriptDir, "resource dir")
|
||||
flag.StringVar(&sessionId, "session-id", "075xx2123", "session id")
|
||||
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.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&gettextDir, "gettext", "", "use gettext translations from given directory")
|
||||
flag.Var(&langs, "language", "add symbol resolution for language")
|
||||
flag.Parse()
|
||||
|
||||
config.Apply(&override)
|
||||
conns, err := config.GetConns()
|
||||
if connStr == "" {
|
||||
connStr = config.DbConn()
|
||||
}
|
||||
connData, err := storage.ToConnData(connStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "connstr err: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logg.Infof("start command", "conn", conns, "outputsize", size)
|
||||
logg.Infof("start command", "conn", connData, "outputsize", size)
|
||||
|
||||
if len(langs.Langs()) == 0 {
|
||||
langs.Set(config.Language())
|
||||
@ -81,7 +80,7 @@ func main() {
|
||||
MenuSeparator: menuSeparator,
|
||||
}
|
||||
|
||||
menuStorageService := storage.NewMenuStorageService(conns)
|
||||
menuStorageService := storage.NewMenuStorageService(connData, resourceDir)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "menu storage service error: %v\n", err)
|
||||
os.Exit(1)
|
||||
@ -123,7 +122,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
accountService := services.New(ctx, menuStorageService)
|
||||
accountService := services.New(ctx, menuStorageService, connData)
|
||||
hl, err := lhs.GetHandler(accountService)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "get accounts service handler: %v\n", err)
|
||||
@ -136,18 +135,6 @@ func main() {
|
||||
en = en.WithDebug(nil)
|
||||
}
|
||||
|
||||
cint := make(chan os.Signal)
|
||||
cterm := make(chan os.Signal)
|
||||
signal.Notify(cint, os.Interrupt, syscall.SIGINT)
|
||||
signal.Notify(cterm, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
select {
|
||||
case _ = <-cint:
|
||||
case _ = <-cterm:
|
||||
}
|
||||
menuStorageService.Close(ctx)
|
||||
}()
|
||||
|
||||
err = engine.Loop(ctx, en, os.Stdin, os.Stdout, nil)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "loop exited with error: %v\n", err)
|
||||
|
@ -31,31 +31,34 @@ var (
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
var override config.Override
|
||||
var connStr string
|
||||
var authConnStr string
|
||||
var resourceDir string
|
||||
var size uint
|
||||
var engineDebug bool
|
||||
var stateDebug bool
|
||||
var host string
|
||||
var port uint
|
||||
//flag.StringVar(&authConnStr, "authdb", "", "auth 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.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.StringVar(&authConnStr, "authdb", "", "auth connection string")
|
||||
flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&host, "h", config.HostSSH(), "socket host")
|
||||
flag.UintVar(&port, "p", config.PortSSH(), "socket port")
|
||||
flag.Parse()
|
||||
|
||||
config.Apply(&override)
|
||||
conns, err := config.GetConns()
|
||||
if connStr == "" {
|
||||
connStr = config.DbConn()
|
||||
}
|
||||
if authConnStr == "" {
|
||||
authConnStr = connStr
|
||||
}
|
||||
connData, err := storage.ToConnData(connStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "connstr err: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
authConnData, err := storage.ToConnData(authConnStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "auth connstr err: %v", err)
|
||||
@ -76,7 +79,7 @@ func main() {
|
||||
logg.WarnCtxf(ctx, "!!!!! Do not expose to internet and only use with tunnel!")
|
||||
logg.WarnCtxf(ctx, "!!!!! (See ssh -L <...>)")
|
||||
|
||||
logg.Infof("start command", "conn", conns, "authconn", authConnData, "outputsize", size, "keyfile", sshKeyFile, "host", host, "port", port)
|
||||
logg.Infof("start command", "conn", connData, "authconn", authConnData, "resourcedir", resourceDir, "outputsize", size, "keyfile", sshKeyFile, "host", host, "port", port)
|
||||
|
||||
pfp := path.Join(scriptDir, "pp.csv")
|
||||
|
||||
@ -99,7 +102,7 @@ func main() {
|
||||
}
|
||||
defer func() {
|
||||
logg.TraceCtxf(ctx, "shutdown auth key store reached")
|
||||
err = authKeyStore.Close(ctx)
|
||||
err = authKeyStore.Close()
|
||||
if err != nil {
|
||||
logg.ErrorCtxf(ctx, "keystore close error", "err", err)
|
||||
}
|
||||
@ -114,7 +117,8 @@ func main() {
|
||||
Cfg: cfg,
|
||||
Debug: engineDebug,
|
||||
FlagFile: pfp,
|
||||
Conn: conns,
|
||||
Conn: connData,
|
||||
ResourceDir: resourceDir,
|
||||
SrvKeyFile: sshKeyFile,
|
||||
Host: host,
|
||||
Port: port,
|
||||
|
@ -34,7 +34,7 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer store.Close(ctx)
|
||||
defer store.Close()
|
||||
|
||||
err = store.AddFromFile(ctx, sshKeyFile, sessionId)
|
||||
if err != nil {
|
||||
|
@ -1,17 +0,0 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
|
||||
)
|
||||
|
||||
type Override struct {
|
||||
DbConn *string
|
||||
StateConn *string
|
||||
ResourceConn *string
|
||||
UserConn *string
|
||||
}
|
||||
|
||||
func Apply(o *Override) error {
|
||||
viseconfig.ApplyConn(o.DbConn, o.StateConn, o.ResourceConn, o.UserConn)
|
||||
return nil
|
||||
}
|
@ -6,17 +6,8 @@ import (
|
||||
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
|
||||
)
|
||||
|
||||
var (
|
||||
GetConns = viseconfig.GetConns
|
||||
EnvPath string
|
||||
)
|
||||
|
||||
func loadEnv() {
|
||||
if EnvPath == "" {
|
||||
env.LoadEnvVariables()
|
||||
} else {
|
||||
env.LoadEnvVariablesPath(EnvPath)
|
||||
}
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
const (
|
||||
@ -26,8 +17,8 @@ const (
|
||||
defaultHTTPPort uint = 7123
|
||||
)
|
||||
|
||||
|
||||
func LoadConfig() error {
|
||||
loadEnv()
|
||||
err := viseconfig.LoadConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -39,6 +30,10 @@ func LoadConfig() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func DbConn() string {
|
||||
return viseconfig.DbConn
|
||||
}
|
||||
|
||||
func Language() string {
|
||||
return viseconfig.DefaultLanguage
|
||||
}
|
||||
|
26
debug/db.go
26
debug/db.go
@ -32,10 +32,18 @@ func (k KeyInfo) String() string {
|
||||
|
||||
func ToKeyInfo(k []byte, sessionId string) (KeyInfo, error) {
|
||||
o := KeyInfo{}
|
||||
b := []byte(sessionId)
|
||||
|
||||
if len(k) <= len(b) {
|
||||
return o, fmt.Errorf("storage key missing")
|
||||
}
|
||||
|
||||
o.SessionId = sessionId
|
||||
|
||||
o.Typ = uint8(k[0])
|
||||
k = k[1:]
|
||||
o.SessionId = string(k[:len(b)])
|
||||
k = k[len(b):]
|
||||
|
||||
if o.Typ == visedb.DATATYPE_USERDATA {
|
||||
if len(k) == 0 {
|
||||
@ -45,18 +53,28 @@ func ToKeyInfo(k []byte, sessionId string) (KeyInfo, error) {
|
||||
o.SubTyp = storedb.DataTyp(v)
|
||||
o.Label = subTypToString(o.SubTyp)
|
||||
k = k[2:]
|
||||
if len(k) != 0 {
|
||||
return o, fmt.Errorf("excess key information: %x", k)
|
||||
}
|
||||
} else {
|
||||
o.Label = typToString(o.Typ)
|
||||
k = k[2:]
|
||||
}
|
||||
|
||||
if len(k) != 0 {
|
||||
return o, fmt.Errorf("excess key information")
|
||||
}
|
||||
|
||||
return o, nil
|
||||
}
|
||||
|
||||
func FromKey(k []byte) (KeyInfo, error) {
|
||||
o := KeyInfo{}
|
||||
|
||||
if len(k) < 4 {
|
||||
return o, fmt.Errorf("insufficient key length")
|
||||
}
|
||||
|
||||
sessionIdBytes := k[1:len(k)-2]
|
||||
return ToKeyInfo(k, string(sessionIdBytes))
|
||||
}
|
||||
|
||||
func subTypToString(v storedb.DataTyp) string {
|
||||
return dbTypStr[v + visedb.DATATYPE_USERDATA + 1]
|
||||
}
|
||||
|
@ -29,9 +29,6 @@ func init() {
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_PUBLIC_KEY_REVERSE] = "public_key_reverse"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_ACTIVE_DECIMAL] = "active decimal"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_ACTIVE_ADDRESS] = "active address"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_INCORRECT_PIN_ATTEMPTS] = "incorrect pin attempts"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_SELECTED_LANGUAGE_CODE] = "selected language"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_INITIAL_LANGUAGE_CODE] = "initial language"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_VOUCHER_SYMBOLS] = "voucher symbols"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_VOUCHER_BALANCES] = "voucher balances"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_VOUCHER_DECIMALS] = "voucher decimals"
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
func TestDebugDbSubKeyInfo(t *testing.T) {
|
||||
s := "foo"
|
||||
b := []byte{0x20}
|
||||
b = append(b, []byte(s)...)
|
||||
b = append(b, []byte{0x00, 0x02}...)
|
||||
r, err := ToKeyInfo(b, s)
|
||||
if err != nil {
|
||||
@ -55,6 +56,7 @@ func TestDebugDbKeyInfo(t *testing.T) {
|
||||
func TestDebugDbKeyInfoRestore(t *testing.T) {
|
||||
s := "bar"
|
||||
b := []byte{visedb.DATATYPE_USERDATA}
|
||||
b = append(b, []byte(s)...)
|
||||
k := storedb.ToBytes(storedb.DATA_ACTIVE_SYM)
|
||||
b = append(b, k...)
|
||||
|
||||
|
@ -24,22 +24,21 @@ func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
var sessionId string
|
||||
var override config.Override
|
||||
var connStr string
|
||||
|
||||
flag.StringVar(&sessionId, "session-id", "075xx2123", "session id")
|
||||
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.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.Parse()
|
||||
|
||||
config.Apply(&override)
|
||||
conns, err := config.GetConns()
|
||||
|
||||
if connStr == "" {
|
||||
connStr = config.DbConn()
|
||||
}
|
||||
connData, err := storage.ToConnData(connStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "connstr err: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, "SessionId", sessionId)
|
||||
|
||||
@ -50,16 +49,16 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
x := cmd.NewCmd(sessionId, flagParser)
|
||||
x := cmd.NewCmd(connData, sessionId, flagParser)
|
||||
err = x.Parse(flag.Args())
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "cmd parse fail: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logg.Infof("start command", "conn", conns, "subcmd", x)
|
||||
logg.Infof("start command", "conn", connData, "subcmd", x)
|
||||
|
||||
menuStorageService := storage.NewMenuStorageService(conns)
|
||||
menuStorageService := storage.NewMenuStorageService(connData, "")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "menu storage service error: %v\n", err)
|
||||
os.Exit(1)
|
||||
|
@ -19,58 +19,55 @@ var (
|
||||
scriptDir = path.Join("services", "registration")
|
||||
)
|
||||
|
||||
func formatItem(k []byte, v []byte, sessionId string) (string, error) {
|
||||
o, err := debug.ToKeyInfo(k, sessionId)
|
||||
func formatItem(k []byte, v []byte) (string, error) {
|
||||
o, err := debug.FromKey(k)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
s := fmt.Sprintf("%v\t%v\n", o.Label, string(v))
|
||||
|
||||
s := fmt.Sprintf("%vValue: %v\n\n", o, string(v))
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
var override config.Override
|
||||
var connStr string
|
||||
var sessionId string
|
||||
var database string
|
||||
var engineDebug bool
|
||||
var err error
|
||||
var first bool
|
||||
|
||||
flag.StringVar(&sessionId, "session-id", "075xx2123", "session id")
|
||||
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.StringVar(&connStr, "c", ".state", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.Parse()
|
||||
|
||||
config.Apply(&override)
|
||||
conns, err := config.GetConns()
|
||||
if connStr != "" {
|
||||
connStr = config.DbConn()
|
||||
}
|
||||
connData, err := storage.ToConnData(connStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "connstr err: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logg.Infof("start command", "conn", conns)
|
||||
logg.Infof("start command", "conn", connData)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, "SessionId", sessionId)
|
||||
ctx = context.WithValue(ctx, "Database", database)
|
||||
|
||||
menuStorageService := storage.NewMenuStorageService(conns)
|
||||
resourceDir := scriptDir
|
||||
menuStorageService := storage.NewMenuStorageService(connData, resourceDir)
|
||||
|
||||
store, err := menuStorageService.GetUserdataDb(ctx)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "get userdata db: %v\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
store.SetSession(sessionId)
|
||||
store.SetPrefix(db.DATATYPE_USERDATA)
|
||||
|
||||
d, err := store.Dump(ctx, []byte(""))
|
||||
d, err := store.Dump(ctx, []byte(sessionId))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "store dump fail: %v\n", err.Error())
|
||||
os.Exit(1)
|
||||
@ -81,19 +78,15 @@ func main() {
|
||||
if k == nil {
|
||||
break
|
||||
}
|
||||
if !first {
|
||||
fmt.Printf("Session ID: %s\n---\n", sessionId)
|
||||
first = true
|
||||
}
|
||||
r, err := formatItem(append([]byte{db.DATATYPE_USERDATA}, k...), v, sessionId)
|
||||
r, err := formatItem(k, v)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "format db item error: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "format db item error: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf(r)
|
||||
}
|
||||
|
||||
err = store.Close(ctx)
|
||||
err = store.Close()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
|
86
devtools/store/generate/main.go
Normal file
86
devtools/store/generate/main.go
Normal file
@ -0,0 +1,86 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha1"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
testdataloader "github.com/peteole/testdata-loader"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/store"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
)
|
||||
|
||||
var (
|
||||
logg = logging.NewVanilla()
|
||||
baseDir = testdataloader.GetBasePath()
|
||||
scriptDir = path.Join("services", "registration")
|
||||
)
|
||||
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
var connStr string
|
||||
var sessionId string
|
||||
var database string
|
||||
var engineDebug bool
|
||||
var err error
|
||||
|
||||
flag.StringVar(&sessionId, "session-id", "075xx2123", "session id")
|
||||
flag.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.Parse()
|
||||
|
||||
if connStr != "" {
|
||||
connStr = config.DbConn()
|
||||
}
|
||||
connData, err := storage.ToConnData(connStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "connstr err: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logg.Infof("start command", "conn", connData)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, "SessionId", sessionId)
|
||||
ctx = context.WithValue(ctx, "Database", database)
|
||||
|
||||
resourceDir := scriptDir
|
||||
menuStorageService := storage.NewMenuStorageService(connData, resourceDir)
|
||||
|
||||
userDb, err := menuStorageService.GetUserdataDb(ctx)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
userStore := store.UserDataStore{userDb}
|
||||
|
||||
h := sha1.New()
|
||||
h.Write([]byte(sessionId))
|
||||
address := h.Sum(nil)
|
||||
addressString := fmt.Sprintf("%x", address)
|
||||
|
||||
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY, []byte(addressString))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = userStore.WriteEntry(ctx, addressString, storedb.DATA_PUBLIC_KEY_REVERSE, []byte(sessionId))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = userDb.Close()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
10
go.mod
10
go.mod
@ -3,11 +3,11 @@ module git.grassecon.net/grassrootseconomics/sarafu-vise
|
||||
go 1.23.4
|
||||
|
||||
require (
|
||||
git.defalsify.org/vise.git v0.2.3-0.20250120121301-10739fb4a8c9
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250121135150-e0b539809805
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250121134912-f7d31e4e8162
|
||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250121135340-ca97e23e8c84
|
||||
git.defalsify.org/vise.git v0.2.3-0.20250115000535-e2d329b3f739
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250113174703-6afccefd1f05
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250115072214-bca7c5de969f
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250115003256-c0534ede1b63
|
||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250113103030-f0b2056fd87d
|
||||
github.com/alecthomas/assert/v2 v2.2.2
|
||||
github.com/gofrs/uuid v4.4.0+incompatible
|
||||
github.com/grassrootseconomics/ussd-data-service v1.2.0-beta
|
||||
|
20
go.sum
20
go.sum
@ -1,13 +1,13 @@
|
||||
git.defalsify.org/vise.git v0.2.3-0.20250120121301-10739fb4a8c9 h1:sPcqXQcywxA8W3W+9qQncLPmsrgqTIlec7vmD4/7vyA=
|
||||
git.defalsify.org/vise.git v0.2.3-0.20250120121301-10739fb4a8c9/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck=
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d h1:5mzLas+jxTUtusOKx4XvU+n2QvrV/mH17MnJRy46siQ=
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60=
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250121135150-e0b539809805 h1:deGnqf4YCsbxhXgjFEjYjTUCvciLEmI26T9IysRsQXY=
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250121135150-e0b539809805/go.mod h1:9bc3d//Qqm11hz7GYRdQc1Uan+0GJIOpvRBbv8cHMu8=
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250121134912-f7d31e4e8162 h1:NaPbgGQ1Nb+yYF+Qj1LSagpjYeDcSXST8iZwONg4afY=
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250121134912-f7d31e4e8162/go.mod h1:pjKp9L/ZsWW3kMB0UoIl1yv9TBIuU33mn9Aghxp7vGk=
|
||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250121135340-ca97e23e8c84 h1:VoBmqsjlRdz+IPbtKsAkc1IrMepjR+QlesZT31Jokrk=
|
||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250121135340-ca97e23e8c84/go.mod h1:DpibtYpnT3nG4Kn556hRAkdu4+CtiI/6MbnQHal51mQ=
|
||||
git.defalsify.org/vise.git v0.2.3-0.20250115000535-e2d329b3f739 h1:w7pj1oh7jXrfajahVYU7m7AfHst4C6jNVzDVoaqJ7e8=
|
||||
git.defalsify.org/vise.git v0.2.3-0.20250115000535-e2d329b3f739/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck=
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250113174703-6afccefd1f05 h1:BenzGx6aDHKDwE23/mWIFD2InYIXyzHroZWV3MF5WUk=
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250113174703-6afccefd1f05/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60=
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250115072214-bca7c5de969f h1:FgccQi8vipX6dUt+GRiRDYHMR3UqC+plz73vw7y3fyU=
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250115072214-bca7c5de969f/go.mod h1:tbA4whUGMUIDgQVdIW0sxWPuuXOvZRSny5zeku5hX4k=
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250115003256-c0534ede1b63 h1:bX7klKZpX+ZZu1LKbtOXDAhV/KK0YwExehiIi0jusAM=
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250115003256-c0534ede1b63/go.mod h1:Syw9TZyigPAM7t9FvicOm36iUnidt45f0SxzT2JniQ8=
|
||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250113103030-f0b2056fd87d h1:q/NO1rEgK3pia32D/tCq5hXfEuJp84COZRwceFvy/MM=
|
||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250113103030-f0b2056fd87d/go.mod h1:AH15xABcvaJr1TCGlih3oGSuwWC0E5IdbHQwuu+E1KI=
|
||||
github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk=
|
||||
github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ=
|
||||
github.com/alecthomas/participle/v2 v2.0.0 h1:Fgrq+MbuSsJwIkw3fEj9h75vDP0Er5JzepJ0/HNHv0g=
|
||||
|
@ -54,7 +54,7 @@ func InitializeTestStore(t *testing.T) (context.Context, *store.UserDataStore) {
|
||||
store := &store.UserDataStore{Db: db}
|
||||
|
||||
t.Cleanup(func() {
|
||||
db.Close(ctx) // Ensure the DB is closed after each test
|
||||
db.Close() // Ensure the DB is closed after each test
|
||||
})
|
||||
|
||||
return ctx, store
|
||||
|
@ -22,8 +22,9 @@ type Cmd struct {
|
||||
exec func(ctx context.Context, ss storage.StorageService) error
|
||||
}
|
||||
|
||||
func NewCmd(sessionId string, flagParser *application.FlagManager) *Cmd {
|
||||
func NewCmd(conn storage.ConnData, sessionId string, flagParser *application.FlagManager) *Cmd {
|
||||
return &Cmd{
|
||||
conn: conn,
|
||||
sessionId: sessionId,
|
||||
flagParser: flagParser,
|
||||
}
|
||||
|
@ -10,13 +10,11 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/testutil/driver"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/testutil"
|
||||
)
|
||||
|
||||
var (
|
||||
logg = logging.NewVanilla().WithDomain("menutraversaltest")
|
||||
testData = driver.ReadData()
|
||||
sessionID string
|
||||
src = rand.NewSource(42)
|
||||
@ -24,6 +22,9 @@ var (
|
||||
)
|
||||
|
||||
var groupTestFile = flag.String("test-file", "group_test.json", "The test file to use for running the group tests")
|
||||
var database = flag.String("db", "gdbm", "Specify the database (gdbm or postgres)")
|
||||
var connStr = flag.String("conn", ".test_state", "connection string")
|
||||
var dbSchema = flag.String("schema", "test", "Specify the database schema (default test)")
|
||||
|
||||
func GenerateSessionId() string {
|
||||
uu := uuid.NewGenWithOptions(uuid.WithRandomReader(g))
|
||||
@ -79,7 +80,12 @@ func extractSendAmount(response []byte) string {
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Parse the flags
|
||||
flag.Parse()
|
||||
sessionID = GenerateSessionId()
|
||||
// set the db
|
||||
testutil.SetDatabase(*database, *connStr, *dbSchema)
|
||||
|
||||
// Cleanup the db after tests
|
||||
defer testutil.CleanDatabase()
|
||||
|
||||
@ -94,8 +100,7 @@ func TestAccountCreationSuccessful(t *testing.T) {
|
||||
for _, session := range sessions {
|
||||
groups := driver.FilterGroupsByName(session.Groups, "account_creation_successful")
|
||||
for _, group := range groups {
|
||||
for i, step := range group.Steps {
|
||||
logg.TraceCtxf(ctx, "executing step", "i", i, "step", step)
|
||||
for _, step := range group.Steps {
|
||||
cont, err := en.Exec(ctx, []byte(step.Input))
|
||||
if err != nil {
|
||||
t.Fatalf("Test case '%s' failed at input '%s': %v", group.Name, step.Input, err)
|
||||
@ -137,8 +142,7 @@ func TestAccountRegistrationRejectTerms(t *testing.T) {
|
||||
for _, session := range sessions {
|
||||
groups := driver.FilterGroupsByName(session.Groups, "account_creation_reject_terms")
|
||||
for _, group := range groups {
|
||||
for i, step := range group.Steps {
|
||||
logg.TraceCtxf(ctx, "executing step", "i", i, "step", step)
|
||||
for _, step := range group.Steps {
|
||||
cont, err := en.Exec(ctx, []byte(step.Input))
|
||||
if err != nil {
|
||||
t.Fatalf("Test case '%s' failed at input '%s': %v", group.Name, step.Input, err)
|
||||
@ -173,8 +177,7 @@ func TestMainMenuHelp(t *testing.T) {
|
||||
for _, session := range sessions {
|
||||
groups := driver.FilterGroupsByName(session.Groups, "main_menu_help")
|
||||
for _, group := range groups {
|
||||
for i, step := range group.Steps {
|
||||
logg.TraceCtxf(ctx, "executing step", "i", i, "step", step)
|
||||
for _, step := range group.Steps {
|
||||
cont, err := en.Exec(ctx, []byte(step.Input))
|
||||
if err != nil {
|
||||
t.Fatalf("Test case '%s' failed at input '%s': %v", group.Name, step.Input, err)
|
||||
|
@ -37,7 +37,7 @@ func (d *localEmitter) emit(ctx context.Context, msg apievent.Msg) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func New(ctx context.Context, storageService storage.StorageService) remote.AccountService {
|
||||
func New(ctx context.Context, storageService storage.StorageService, conn storage.ConnData) remote.AccountService {
|
||||
svc := devremote.NewDevAccountService(ctx, storageService)
|
||||
svc = svc.WithAutoVoucher(ctx, "FOO", 42)
|
||||
eu := event.NewEventsUpdater(svc, storageService)
|
||||
|
@ -4,8 +4,8 @@ TXTS = $(wildcard ./*.txt.orig)
|
||||
VISE_PATH := ../../go-vise
|
||||
|
||||
# Rule to build .bin files from .vis files
|
||||
%.vis: buildasm
|
||||
./vise-asm -f pp.csv $(basename $@).vis > $(basename $@).bin
|
||||
%.vis:
|
||||
go run $(VISE_PATH)/dev/asm/main.go -f pp.csv $(basename $@).vis > $(basename $@).bin
|
||||
@echo "Built $(basename $@).bin from $(basename $@).vis"
|
||||
|
||||
# Rule to copy .orig files to .txt
|
||||
@ -19,10 +19,5 @@ all: $(INPUTS) $(TXTS)
|
||||
|
||||
clean:
|
||||
rm -vf *.bin
|
||||
rm -vf ./vise-asm
|
||||
|
||||
buildasm:
|
||||
go build -v -o ./vise-asm $(VISE_PATH)/dev/asm/main.go
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
|
BIN
services/registration/_catch.bin
Normal file
BIN
services/registration/_catch.bin
Normal file
Binary file not shown.
BIN
services/registration/account_creation.bin
Normal file
BIN
services/registration/account_creation.bin
Normal file
Binary file not shown.
BIN
services/registration/account_creation_failed.bin
Normal file
BIN
services/registration/account_creation_failed.bin
Normal file
Binary file not shown.
BIN
services/registration/account_pending.bin
Normal file
BIN
services/registration/account_pending.bin
Normal file
Binary file not shown.
BIN
services/registration/address.bin
Normal file
BIN
services/registration/address.bin
Normal file
Binary file not shown.
BIN
services/registration/amount.bin
Normal file
BIN
services/registration/amount.bin
Normal file
Binary file not shown.
BIN
services/registration/api_failure.bin
Normal file
BIN
services/registration/api_failure.bin
Normal file
Binary file not shown.
BIN
services/registration/balances.bin
Normal file
BIN
services/registration/balances.bin
Normal file
Binary file not shown.
BIN
services/registration/blocked_account.bin
Normal file
BIN
services/registration/blocked_account.bin
Normal file
Binary file not shown.
BIN
services/registration/change_language.bin
Normal file
BIN
services/registration/change_language.bin
Normal file
Binary file not shown.
BIN
services/registration/check_statement.bin
Normal file
BIN
services/registration/check_statement.bin
Normal file
Binary file not shown.
BIN
services/registration/community_balance.bin
Normal file
BIN
services/registration/community_balance.bin
Normal file
Binary file not shown.
BIN
services/registration/confirm_create_pin.bin
Normal file
BIN
services/registration/confirm_create_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/confirm_others_new_pin.bin
Normal file
BIN
services/registration/confirm_others_new_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/confirm_pin_change.bin
Normal file
BIN
services/registration/confirm_pin_change.bin
Normal file
Binary file not shown.
BIN
services/registration/create_pin.bin
Normal file
BIN
services/registration/create_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/create_pin_mismatch.bin
Normal file
BIN
services/registration/create_pin_mismatch.bin
Normal file
Binary file not shown.
BIN
services/registration/display_profile_info.bin
Normal file
BIN
services/registration/display_profile_info.bin
Normal file
Binary file not shown.
BIN
services/registration/edit_family_name.bin
Normal file
BIN
services/registration/edit_family_name.bin
Normal file
Binary file not shown.
BIN
services/registration/edit_first_name.bin
Normal file
BIN
services/registration/edit_first_name.bin
Normal file
Binary file not shown.
BIN
services/registration/edit_location.bin
Normal file
BIN
services/registration/edit_location.bin
Normal file
Binary file not shown.
BIN
services/registration/edit_offerings.bin
Normal file
BIN
services/registration/edit_offerings.bin
Normal file
Binary file not shown.
BIN
services/registration/edit_profile.bin
Normal file
BIN
services/registration/edit_profile.bin
Normal file
Binary file not shown.
BIN
services/registration/edit_yob.bin
Normal file
BIN
services/registration/edit_yob.bin
Normal file
Binary file not shown.
BIN
services/registration/enter_other_number.bin
Normal file
BIN
services/registration/enter_other_number.bin
Normal file
Binary file not shown.
BIN
services/registration/enter_others_new_pin.bin
Normal file
BIN
services/registration/enter_others_new_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/enter_pin.bin
Normal file
BIN
services/registration/enter_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/help.bin
Normal file
BIN
services/registration/help.bin
Normal file
Binary file not shown.
BIN
services/registration/incorrect_date_format.bin
Normal file
BIN
services/registration/incorrect_date_format.bin
Normal file
Binary file not shown.
BIN
services/registration/incorrect_pin.bin
Normal file
BIN
services/registration/incorrect_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/invalid_amount.bin
Normal file
BIN
services/registration/invalid_amount.bin
Normal file
Binary file not shown.
BIN
services/registration/invalid_others_pin.bin
Normal file
BIN
services/registration/invalid_others_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/invalid_pin.bin
Normal file
BIN
services/registration/invalid_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/invalid_recipient.bin
Normal file
BIN
services/registration/invalid_recipient.bin
Normal file
Binary file not shown.
BIN
services/registration/invite_recipient.bin
Normal file
BIN
services/registration/invite_recipient.bin
Normal file
Binary file not shown.
BIN
services/registration/invite_result.bin
Normal file
BIN
services/registration/invite_result.bin
Normal file
Binary file not shown.
BIN
services/registration/language_changed.bin
Normal file
BIN
services/registration/language_changed.bin
Normal file
Binary file not shown.
0
services/registration/list_offering.bin
Normal file
0
services/registration/list_offering.bin
Normal file
BIN
services/registration/main.bin
Normal file
BIN
services/registration/main.bin
Normal file
Binary file not shown.
BIN
services/registration/my_account.bin
Normal file
BIN
services/registration/my_account.bin
Normal file
Binary file not shown.
BIN
services/registration/my_balance.bin
Normal file
BIN
services/registration/my_balance.bin
Normal file
Binary file not shown.
BIN
services/registration/my_vouchers.bin
Normal file
BIN
services/registration/my_vouchers.bin
Normal file
Binary file not shown.
BIN
services/registration/new_pin.bin
Normal file
BIN
services/registration/new_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/no_admin_privilege.bin
Normal file
BIN
services/registration/no_admin_privilege.bin
Normal file
Binary file not shown.
BIN
services/registration/no_transfers.bin
Normal file
BIN
services/registration/no_transfers.bin
Normal file
Binary file not shown.
BIN
services/registration/no_voucher.bin
Normal file
BIN
services/registration/no_voucher.bin
Normal file
Binary file not shown.
BIN
services/registration/old_pin.bin
Normal file
BIN
services/registration/old_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/others_pin_mismatch.bin
Normal file
BIN
services/registration/others_pin_mismatch.bin
Normal file
Binary file not shown.
BIN
services/registration/pin_entry.bin
Normal file
BIN
services/registration/pin_entry.bin
Normal file
Binary file not shown.
BIN
services/registration/pin_management.bin
Normal file
BIN
services/registration/pin_management.bin
Normal file
Binary file not shown.
BIN
services/registration/pin_reset_mismatch.bin
Normal file
BIN
services/registration/pin_reset_mismatch.bin
Normal file
Binary file not shown.
BIN
services/registration/pin_reset_result.bin
Normal file
BIN
services/registration/pin_reset_result.bin
Normal file
Binary file not shown.
BIN
services/registration/pin_reset_success.bin
Normal file
BIN
services/registration/pin_reset_success.bin
Normal file
Binary file not shown.
BIN
services/registration/profile_update_success.bin
Normal file
BIN
services/registration/profile_update_success.bin
Normal file
Binary file not shown.
BIN
services/registration/quit.bin
Normal file
BIN
services/registration/quit.bin
Normal file
Binary file not shown.
BIN
services/registration/root.bin
Normal file
BIN
services/registration/root.bin
Normal file
Binary file not shown.
BIN
services/registration/select_gender.bin
Normal file
BIN
services/registration/select_gender.bin
Normal file
Binary file not shown.
BIN
services/registration/select_language.bin
Normal file
BIN
services/registration/select_language.bin
Normal file
Binary file not shown.
BIN
services/registration/select_voucher.bin
Normal file
BIN
services/registration/select_voucher.bin
Normal file
Binary file not shown.
BIN
services/registration/send.bin
Normal file
BIN
services/registration/send.bin
Normal file
Binary file not shown.
BIN
services/registration/set_default.bin
Normal file
BIN
services/registration/set_default.bin
Normal file
Binary file not shown.
BIN
services/registration/set_eng.bin
Normal file
BIN
services/registration/set_eng.bin
Normal file
Binary file not shown.
BIN
services/registration/set_female.bin
Normal file
BIN
services/registration/set_female.bin
Normal file
Binary file not shown.
BIN
services/registration/set_male.bin
Normal file
BIN
services/registration/set_male.bin
Normal file
Binary file not shown.
BIN
services/registration/set_swa.bin
Normal file
BIN
services/registration/set_swa.bin
Normal file
Binary file not shown.
BIN
services/registration/set_unspecified.bin
Normal file
BIN
services/registration/set_unspecified.bin
Normal file
Binary file not shown.
BIN
services/registration/terms.bin
Normal file
BIN
services/registration/terms.bin
Normal file
Binary file not shown.
BIN
services/registration/transaction_initiated.bin
Normal file
BIN
services/registration/transaction_initiated.bin
Normal file
Binary file not shown.
BIN
services/registration/transaction_pin.bin
Normal file
BIN
services/registration/transaction_pin.bin
Normal file
Binary file not shown.
BIN
services/registration/transactions.bin
Normal file
BIN
services/registration/transactions.bin
Normal file
Binary file not shown.
BIN
services/registration/unregistered_number.bin
Normal file
BIN
services/registration/unregistered_number.bin
Normal file
Binary file not shown.
BIN
services/registration/update_familyname.bin
Normal file
BIN
services/registration/update_familyname.bin
Normal file
Binary file not shown.
BIN
services/registration/update_firstname.bin
Normal file
BIN
services/registration/update_firstname.bin
Normal file
Binary file not shown.
BIN
services/registration/update_gender.bin
Normal file
BIN
services/registration/update_gender.bin
Normal file
Binary file not shown.
BIN
services/registration/update_location.bin
Normal file
BIN
services/registration/update_location.bin
Normal file
Binary file not shown.
BIN
services/registration/update_offerings.bin
Normal file
BIN
services/registration/update_offerings.bin
Normal file
Binary file not shown.
BIN
services/registration/update_profile_items.bin
Normal file
BIN
services/registration/update_profile_items.bin
Normal file
Binary file not shown.
BIN
services/registration/update_success.bin
Normal file
BIN
services/registration/update_success.bin
Normal file
Binary file not shown.
BIN
services/registration/update_yob.bin
Normal file
BIN
services/registration/update_yob.bin
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user