able to parse xml

This commit is contained in:
2024-01-28 16:49:48 +03:00
parent 90a7797a27
commit bfa105df95
12 changed files with 298 additions and 89 deletions

View File

@ -20,6 +20,10 @@ import (
// Yeah, singleton is not good UNLESS you're really lazy
var diInjector *do.Injector
func GetEwayClient() (eway.Client, error) {
return do.Invoke[eway.Client](diInjector)
}
func GetRepository() (storage.Repository, error) {
adapter, err := do.Invoke[*storageRepositoryAdapter](diInjector)
if err != nil {
@ -57,7 +61,11 @@ func SetupDI(ctx context.Context, cfgpath string) error {
return nil, fmt.Errorf("getting logger: %w", err)
}
client := eway.New(eway.Config(cfg.Eway), log)
client, err := eway.New(eway.Config(cfg.Eway), log)
if err != nil {
return nil, fmt.Errorf("making new eway client: %w", err)
}
return client, nil
})
@ -103,9 +111,9 @@ func getDB() (*badger.DB, error) {
}
type settings struct {
Badger config.Badger
Log config.Log
Eway config.Eway
Badger config.Badger `toml:"badger"`
Log config.Log `toml:"log"`
Eway config.Eway `toml:"eway"`
}
func parseSettings(cfgpath string) (cfg settings, err error) {