Config has a .storage, .queue, .driiver

main
Bel LaPointe 2024-04-12 09:21:36 -06:00
parent c51e580e09
commit 24628f4ebb
2 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,9 @@ type Config struct {
InitializeSlack bool InitializeSlack bool
SlackToken string SlackToken string
SlackChannels string SlackChannels string
storage Storage
queue Queue
driver Driver
} }
func newConfig() (Config, error) { func newConfig() (Config, error) {
@ -73,5 +76,10 @@ func newConfigFromEnv(getEnv func(string) string) (Config, error) {
} else if err := json.Unmarshal(b, &result); err != nil { } else if err := json.Unmarshal(b, &result); err != nil {
return Config{}, err return Config{}, err
} }
result.driver = NewRAM()
result.storage = NewStorage(result.driver)
result.queue = NewQueue(result.driver)
return result, nil return result, nil
} }

View File

@ -23,6 +23,7 @@ func main() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
defer cfg.driver.Close()
if err := run(ctx, cfg); err != nil && ctx.Err() == nil { if err := run(ctx, cfg); err != nil && ctx.Err() == nil {
panic(err) panic(err)