Initial commit: Custom Start Page application with authentication and DynamoDB storage
This commit is contained in:
33
cmd/init-db/main.go
Normal file
33
cmd/init-db/main.go
Normal file
@@ -0,0 +1,33 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user