added preauth releaser
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// cmd/hardlink-preauth-release/main.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"gitea.futuresens.co.uk/futuresens/hardlink/bootstrap"
|
||||
"gitea.futuresens.co.uk/futuresens/hardlink/config"
|
||||
"gitea.futuresens.co.uk/futuresens/hardlink/logging"
|
||||
"gitea.futuresens.co.uk/futuresens/hardlink/payment"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
buildVersion = "1.0.0"
|
||||
serviceName = "preauth-release"
|
||||
)
|
||||
|
||||
func main() {
|
||||
config := config.ReadPreauthReleaserConfig()
|
||||
// Setup logging and get file handle
|
||||
logFile, err := logging.SetupLogging(config.LogDir, serviceName, buildVersion)
|
||||
if err != nil {
|
||||
log.Printf("Failed to set up logging: %v\n", err)
|
||||
}
|
||||
defer logFile.Close()
|
||||
database, err := bootstrap.OpenDB(&config)
|
||||
if err != nil {
|
||||
log.WithError(err).Fatal("DB init failed")
|
||||
}
|
||||
defer database.Close()
|
||||
|
||||
if err := payment.ReleasePreauthorizations(database); err != nil {
|
||||
log.WithError(err).Fatal("Preauth release failed")
|
||||
}
|
||||
|
||||
log.Info("Task completed successfully")
|
||||
fmt.Println(". Press Enter to exit...")
|
||||
fmt.Scanln()
|
||||
os.Exit(0)
|
||||
}
|
||||
Reference in New Issue
Block a user