···2323 export GOLOG_LOG_LEVEL=info
24242525 # setup and create initial accounts; 100 by default
2626+ # supply --use-invite-code and/or --domain-suffix SUFFIX as needed
2627 go run ./cmd/fakermaker/ gen-accounts > data/fakermaker/accounts.json
27282829 # create or update profiles for all the accounts
+31-2
cmd/fakermaker/main.go
···55package main
6677import (
88+ "context"
89 "encoding/json"
910 "fmt"
1011 "os"
1112 "runtime"
12131414+ comatproto "github.com/bluesky-social/indigo/api/atproto"
1315 "github.com/bluesky-social/indigo/fakedata"
1416 "github.com/bluesky-social/indigo/util/cliutil"
1517 "github.com/bluesky-social/indigo/util/version"
···6971 Name: "count-celebrities",
7072 Usage: "number of accounts as 'celebrities' (many followers)",
7173 Value: 10,
7474+ },
7575+ &cli.StringFlag{
7676+ Name: "domain-suffix",
7777+ Usage: "domain to register handle under",
7878+ Value: "test",
7979+ },
8080+ &cli.BoolFlag{
8181+ Name: "use-invite-code",
8282+ Usage: "create and use an invite code",
8383+ Value: false,
7284 },
7385 },
7486 },
···203215204216 countTotal := cctx.Int("count")
205217 countCelebrities := cctx.Int("count-celebrities")
218218+ domainSuffix := cctx.String("domain-suffix")
206219 if countCelebrities > countTotal {
207220 return fmt.Errorf("more celebrities than total accounts!")
208221 }
209222 countRegulars := countTotal - countCelebrities
210223224224+ var inviteCode *string = nil
225225+ if cctx.Bool("use-invite-code") {
226226+ resp, err := comatproto.ServerCreateInviteCodes(context.TODO(), xrpcc, &comatproto.ServerCreateInviteCodes_Input{
227227+ UseCount: int64(countTotal),
228228+ ForAccounts: nil,
229229+ CodeCount: 1,
230230+ })
231231+ if err != nil {
232232+ return err
233233+ }
234234+ if len(resp.Codes) != 1 || len(resp.Codes[0].Codes) != 1 {
235235+ return fmt.Errorf("expected a single invite code")
236236+ }
237237+ inviteCode = &resp.Codes[0].Codes[0]
238238+ }
239239+211240 // call helper to do actual creation
212241 var usr *fakedata.AccountContext
213242 var line []byte
214243 t1 := fakedata.MeasureIterations("register celebrity accounts")
215244 for i := 0; i < countCelebrities; i++ {
216216- if usr, err = fakedata.GenAccount(xrpcc, i, "celebrity"); err != nil {
245245+ if usr, err = fakedata.GenAccount(xrpcc, i, "celebrity", domainSuffix, inviteCode); err != nil {
217246 return err
218247 }
219248 // compact single-line JSON by default
···226255227256 t2 := fakedata.MeasureIterations("register regular accounts")
228257 for i := 0; i < countRegulars; i++ {
229229- if usr, err = fakedata.GenAccount(xrpcc, i, "regular"); err != nil {
258258+ if usr, err = fakedata.GenAccount(xrpcc, i, "regular", domainSuffix, inviteCode); err != nil {
230259 return err
231260 }
232261 // compact single-line JSON by default