| 42 | } |
| 43 | |
| 44 | func (a *API) info(ctx context.Context) (map[string]interface{}, error) { |
| 45 | if a.config == nil { |
| 46 | // never configured |
| 47 | return map[string]interface{}{ |
| 48 | "is_configured": false, |
| 49 | "version": config.Version, |
| 50 | "build_commit": config.BuildCommit, |
| 51 | "build_date": config.BuildDate, |
| 52 | "build_config": config.BuildConfig, |
| 53 | }, nil |
| 54 | } |
| 55 | // If we're not the leader, forward to the leader. |
| 56 | if a.leader.State() == leader.Following { |
| 57 | var resp map[string]interface{} |
| 58 | err := a.forwardToLeader(ctx, "/info", nil, &resp) |
| 59 | return resp, err |
| 60 | } |
| 61 | return a.leaderInfo(ctx) |
| 62 | } |
| 63 | |
| 64 | func (a *API) leaderInfo(ctx context.Context) (map[string]interface{}, error) { |
| 65 | var generatorHeight uint64 |