Skip to content

Commit

Permalink
Move hungry address filling to correct place. Fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jun 22, 2023
1 parent 373c530 commit f7c0e82
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd/bbctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ func prepareApp(ctx *cli.Context) error {
envConfig := cfg.Environments.Get(env)
ctx.Context = context.WithValue(ctx.Context, contextKeyConfig, cfg)
ctx.Context = context.WithValue(ctx.Context, contextKeyEnvConfig, envConfig)
if envConfig.HungryAddress == "" {
whoami, err := beeperapi.Whoami(homeserver, envConfig.AccessToken)
if err != nil {
return fmt.Errorf("failed to get whoami: %w", err)
}
SaveHungryURL(ctx, whoami.UserInfo.HungryURL)
}
if envConfig.HasCredentials() {
if envConfig.HungryAddress == "" {
whoami, err := beeperapi.Whoami(homeserver, envConfig.AccessToken)
if err != nil {
return fmt.Errorf("failed to get whoami: %w", err)
}
SaveHungryURL(ctx, whoami.UserInfo.HungryURL)
}
homeserver := ctx.String("homeserver")
ctx.Context = context.WithValue(ctx.Context, contextKeyMatrixClient, NewMatrixAPI(homeserver, envConfig.Username, envConfig.AccessToken))
ctx.Context = context.WithValue(ctx.Context, contextKeyHungryClient, hungryapi.NewClient(homeserver, envConfig.HungryAddress, envConfig.Username, envConfig.AccessToken))
Expand Down

0 comments on commit f7c0e82

Please sign in to comment.