Files
story/scripts/local-phone-account/main.go
T

31 lines
957 B
Go
Raw Normal View History

// Local fixture setup only. Run explicitly after the local seed and migration 61.
package main
import (
"context"
"data-terminal-cloud/internal/onboarding"
"fmt"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/redis/go-redis/v9"
"os"
)
func main() {
ctx := context.Background()
pool, err := pgxpool.New(ctx, "postgres://voice:voice_dev_only@127.0.0.1:55432/voice_platform?sslmode=disable")
check(err)
defer pool.Close()
r := redis.NewClient(&redis.Options{Addr: "127.0.0.1:56379"})
defer r.Close()
s, err := onboarding.NewService(pool, r, onboarding.Options{MasterKey: os.Getenv("ONBOARDING_MASTER_KEY"), EntryURL: "http://localhost:3100/onboarding/entry", AllowLocalHTTP: true})
check(err)
check(s.ProvisionLocalDemoPhone(ctx, os.Getenv("LOCAL_DEMO_PASSWORD")))
fmt.Println("Local demo phone account provisioned; existing credentials preserved.")
}
func check(err error) {
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}