- Add scripts/build.sh to compile binaries into bin/ directory - Move all zerolog setup logic from cmd/server/main.go to pkg/config - Add log level configuration support (trace, debug, info, warn, error, fatal, panic) - Simplify cmd/server/main.go from 57 to 27 lines (53% reduction) - Update .gitignore to use bin/ directory instead of individual files - Document build process and bin directory in AGENTS.md - Maintain backward compatibility with all existing functionality
28 lines
613 B
Go
28 lines
613 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
"DanceLessonsCoach/pkg/config"
|
|
"DanceLessonsCoach/pkg/server"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func main() {
|
|
// Load configuration (this will also setup logging)
|
|
cfg, err := config.LoadConfig()
|
|
if err != nil {
|
|
log.Fatal().Err(err).Msg("Failed to load configuration")
|
|
}
|
|
|
|
// Create readiness context to control readiness state
|
|
readyCtx, readyCancel := context.WithCancel(context.Background())
|
|
defer readyCancel()
|
|
|
|
// Create and run server
|
|
server := server.NewServer(cfg, readyCtx)
|
|
if err := server.Run(); err != nil {
|
|
log.Fatal().Err(err).Msg("Server failed")
|
|
}
|
|
}
|