Skip to content

Commit

Permalink
improve startup logs
Browse files Browse the repository at this point in the history
  • Loading branch information
stv0g committed Jun 10, 2022
1 parent 2709591 commit ac671a9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ func APIMiddleware(svrs server.List, shortener *shortener.Shortener, cfg *config
}

func run(cfg *config.Config) {
var err error

svrs := server.NewList(cfg.Servers)

log.Printf("Initializing S3 servers. Please wait...")
if err := svrs.Setup(); err != nil {
log.Fatalf("Failed to setup servers: %s", err)
}
log.Printf("Initialization of %d servers completed.", len(svrs))

var err error
var short *shortener.Shortener
if cfg.Shortener != nil {
if short, err = shortener.NewShortener(cfg.Shortener); err != nil {
Expand All @@ -74,8 +75,8 @@ func run(cfg *config.Config) {
router.Use(APIMiddleware(svrs, short, cfg))
router.Use(StaticMiddleware(cfg))

router.GET(apiBase+"/healthz", handlers.HandleHealthz)
router.GET(apiBase+"/config", handlers.HandleConfigWith(version, commit, date))
router.GET(apiBase+"/healthz", handlers.HandleHealthz)
router.POST(apiBase+"/initiate", handlers.HandleInitiate)
router.POST(apiBase+"/part", handlers.HandlePart)
router.POST(apiBase+"/complete", handlers.HandleComplete)
Expand Down

0 comments on commit ac671a9

Please sign in to comment.