Implement api selector for all runners

This commit is contained in:
lash 2025-01-15 07:57:53 +00:00
parent 0a7152d6b8
commit ff06b92ffd
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 11 additions and 6 deletions

View File

@ -17,7 +17,7 @@ import (
"git.grassecon.net/grassrootseconomics/sarafu-vise/config" "git.grassecon.net/grassrootseconomics/sarafu-vise/config"
"git.grassecon.net/grassrootseconomics/visedriver/storage" "git.grassecon.net/grassrootseconomics/visedriver/storage"
"git.grassecon.net/grassrootseconomics/visedriver/request" "git.grassecon.net/grassrootseconomics/visedriver/request"
httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http" "git.grassecon.net/grassrootseconomics/sarafu-vise/services"
"git.grassecon.net/grassrootseconomics/sarafu-vise/args" "git.grassecon.net/grassrootseconomics/sarafu-vise/args"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
) )
@ -125,7 +125,8 @@ func main() {
lhs, err := handlers.NewLocalHandlerService(ctx, pfp, true, dbResource, cfg, rs) lhs, err := handlers.NewLocalHandlerService(ctx, pfp, true, dbResource, cfg, rs)
lhs.SetDataStore(&userdataStore) lhs.SetDataStore(&userdataStore)
accountService := &httpremote.HTTPAccountService{}
accountService := services.New(ctx, menuStorageService, connData)
hl, err := lhs.GetHandler(accountService) hl, err := lhs.GetHandler(accountService)
if err != nil { if err != nil {

View File

@ -21,7 +21,7 @@ import (
"git.grassecon.net/grassrootseconomics/visedriver/request" "git.grassecon.net/grassrootseconomics/visedriver/request"
"git.grassecon.net/grassrootseconomics/visedriver/storage" "git.grassecon.net/grassrootseconomics/visedriver/storage"
httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http" "git.grassecon.net/grassrootseconomics/sarafu-vise/services"
"git.grassecon.net/grassrootseconomics/sarafu-vise/args" "git.grassecon.net/grassrootseconomics/sarafu-vise/args"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
) )
@ -116,7 +116,8 @@ func main() {
os.Exit(1) os.Exit(1)
} }
accountService := &httpremote.HTTPAccountService{} accountService := services.New(ctx, menuStorageService, connData)
hl, err := lhs.GetHandler(accountService) hl, err := lhs.GetHandler(accountService)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, err.Error())
@ -130,6 +131,8 @@ func main() {
} }
defer stateStore.Close() defer stateStore.Close()
//accountService := services.New(ctx, menuStorageService, connData)
rp := &httprequest.DefaultRequestParser{} rp := &httprequest.DefaultRequestParser{}
bsh := request.NewBaseRequestHandler(cfg, rs, stateStore, userdataStore, rp, hl) bsh := request.NewBaseRequestHandler(cfg, rs, stateStore, userdataStore, rp, hl)
sh := httprequest.NewHTTPRequestHandler(bsh) sh := httprequest.NewHTTPRequestHandler(bsh)

View File

@ -17,7 +17,7 @@ import (
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/state" "git.defalsify.org/vise.git/state"
"git.grassecon.net/grassrootseconomics/visedriver/storage" "git.grassecon.net/grassrootseconomics/visedriver/storage"
httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http" "git.grassecon.net/grassrootseconomics/sarafu-vise/services"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
) )
@ -180,7 +180,8 @@ func(s *SshRunner) GetEngine(sessionId string) (engine.Engine, func(), error) {
} }
// TODO: clear up why pointer here and by-value other cmds // TODO: clear up why pointer here and by-value other cmds
accountService := &httpremote.HTTPAccountService{} accountService := services.New(ctx, menuStorageService, s.Conn)
hl, err := lhs.GetHandler(accountService) hl, err := lhs.GetHandler(accountService)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err