34 lines
704 B
Go
34 lines
704 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"custom-start-page/internal/storage"
|
|
)
|
|
|
|
func main() {
|
|
endpoint := flag.String("endpoint", "http://localhost:8000", "DynamoDB endpoint")
|
|
flag.Parse()
|
|
|
|
ctx := context.Background()
|
|
|
|
log.Printf("Connecting to DynamoDB at %s...", *endpoint)
|
|
db, err := storage.NewDynamoDBClient(ctx, *endpoint)
|
|
if err != nil {
|
|
log.Fatalf("Failed to create DynamoDB client: %v", err)
|
|
}
|
|
|
|
log.Println("Creating Users table...")
|
|
if err := db.CreateUsersTable(ctx); err != nil {
|
|
log.Fatalf("Failed to create Users table: %v", err)
|
|
}
|
|
log.Println("✓ Users table created successfully")
|
|
|
|
fmt.Println("\nDatabase initialization complete!")
|
|
os.Exit(0)
|
|
}
|