Init commit

This commit is contained in:
2026-01-27 15:31:58 +03:00
commit e6dc59c266
37 changed files with 1707 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
package main
import (
"GoFinanceManager/src/api"
"GoFinanceManager/src/bot"
"GoFinanceManager/src/config"
"context"
"log"
)
func main() {
var runnable []Runnable
cfg, err := config.Load()
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
if cfg.RunMode == config.API || cfg.RunMode == config.Standalone {
server := api.NewServer(cfg)
runnable = append(runnable, func(ctx context.Context) error {
log.Println("API started on", cfg.APIPort)
return server.Start()
})
runnable = append(runnable, func(ctx context.Context) error {
<-ctx.Done()
return server.Shutdown(context.Background())
})
}
if cfg.RunMode == config.Bot || cfg.RunMode == config.Standalone {
tgBot, _ := bot.NewBot(cfg)
log.Println("Bot started...")
runnable = append(runnable, func(ctx context.Context) error {
return tgBot.Start(ctx)
})
}
Run(ctx, runnable...)
}