Files
aleesa-webapp-go/cmd/celebratoday_test/main.go
eleksir f2fc168abe Replace prazdnikisegodnyaru with celebratoday, small underhood fixes
- Replace prazdnikisegodnyaru with celebratoday as first is banned in Russia
- Update .golangci.yml rule set
- Megatons of fixes for linter
- Update README.md
2026-02-10 20:05:13 +03:00

45 lines
827 B
Go

// Package main implements celebratoday api test.
package main
import (
"fmt"
"os"
"aleesa-webapp-go/internal/celebratoday"
"aleesa-webapp-go/internal/log"
"aleesa-webapp-go/internal/webapp"
)
func main() {
var (
logfile *os.File
)
err := webapp.ReadConfig()
if err != nil {
log.Errorf("Unable to parse config: %s", err)
os.Exit(1)
}
// Откроем лог и скормим его логгеру.
if webapp.Config.Log != "" {
logfile, err = os.OpenFile(webapp.Config.Log, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
if err != nil {
log.Errorf("Unable to open log file %s: %s", webapp.Config.Log, err)
os.Exit(1)
}
}
log.Init(webapp.Config.Loglevel, logfile)
str, err := celebratoday.APIClient(webapp.Config)
if err != nil {
fmt.Printf("Error: %s\n", err)
}
fmt.Println(str)
}