Initial commit: Database Backup Tool v1.1.0
- PostgreSQL and MySQL support - Interactive TUI with fixed menu navigation - Line-by-line progress display - CPU-aware parallel processing - Cross-platform build support - Configuration settings menu - Silent mode for TUI operations
This commit is contained in:
50
main.go
Normal file
50
main.go
Normal file
@ -0,0 +1,50 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"dbbackup/cmd"
|
||||
"dbbackup/internal/config"
|
||||
"dbbackup/internal/logger"
|
||||
)
|
||||
|
||||
// Build information (set by ldflags)
|
||||
var (
|
||||
version = "dev"
|
||||
buildTime = "unknown"
|
||||
gitCommit = "unknown"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create context that cancels on interrupt
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
|
||||
// Initialize configuration
|
||||
cfg := config.New()
|
||||
|
||||
// Set version information
|
||||
cfg.Version = version
|
||||
cfg.BuildTime = buildTime
|
||||
cfg.GitCommit = gitCommit
|
||||
|
||||
// Optimize CPU settings if auto-detect is enabled
|
||||
if cfg.AutoDetectCores {
|
||||
if err := cfg.OptimizeForCPU(); err != nil {
|
||||
slog.Warn("CPU optimization failed", "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize logger
|
||||
log := logger.New(cfg.LogLevel, cfg.LogFormat)
|
||||
|
||||
// Execute command
|
||||
if err := cmd.Execute(ctx, cfg, log); err != nil {
|
||||
log.Error("Application failed", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user