32 lines
529 B
Go
32 lines
529 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
|
|
"messenger/internal/platform/config"
|
|
"messenger/internal/platform/s3store"
|
|
)
|
|
|
|
func main() {
|
|
if err := run(); err != nil {
|
|
fmt.Fprintln(os.Stderr, "bucket bootstrap failed:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
func run() error {
|
|
cfg, err := config.LoadS3(os.LookupEnv)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
s, err := s3store.New(cfg)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
|
defer cancel()
|
|
return s.Bootstrap(ctx)
|
|
}
|