( ctx context.Context, ce *clienv.CliEnv, cfg *model.ConfigConfig, appVersion string, )
| 86 | } |
| 87 | |
| 88 | func CheckVersions( |
| 89 | ctx context.Context, |
| 90 | ce *clienv.CliEnv, |
| 91 | cfg *model.ConfigConfig, |
| 92 | appVersion string, |
| 93 | ) error { |
| 94 | var secrets model.Secrets |
| 95 | if err := clienv.UnmarshalFile(ce.Path.Secrets(), &secrets, env.Unmarshal); err != nil { |
| 96 | return fmt.Errorf( |
| 97 | "failed to parse secrets, make sure secret values are between quotes: %w", |
| 98 | err, |
| 99 | ) |
| 100 | } |
| 101 | |
| 102 | cl, err := ce.GetNhostPublicClient() |
| 103 | if err != nil { |
| 104 | return fmt.Errorf("failed to get nhost client: %w", err) |
| 105 | } |
| 106 | |
| 107 | swv, err := cl.GetSoftwareVersions(ctx) |
| 108 | if err != nil { |
| 109 | return fmt.Errorf("failed to get software versions: %w", err) |
| 110 | } |
| 111 | |
| 112 | checkServiceVersion( |
| 113 | ce, graphql.SoftwareTypeEnumAuth, *cfg.GetAuth().GetVersion(), swv, |
| 114 | "https://github.com/nhost/nhost/releases", |
| 115 | ) |
| 116 | checkServiceVersion( |
| 117 | ce, graphql.SoftwareTypeEnumStorage, *cfg.GetStorage().GetVersion(), swv, |
| 118 | "https://github.com/nhost/nhost/releases", |
| 119 | ) |
| 120 | checkServiceVersion( |
| 121 | ce, graphql.SoftwareTypeEnumPostgreSQL, *cfg.GetPostgres().GetVersion(), swv, |
| 122 | "https://hub.docker.com/r/nhost/postgres", |
| 123 | ) |
| 124 | checkServiceVersion(ce, graphql.SoftwareTypeEnumHasura, *cfg.GetHasura().GetVersion(), swv, "") |
| 125 | |
| 126 | if cfg.GetAi() != nil { |
| 127 | checkServiceVersion( |
| 128 | ce, graphql.SoftwareTypeEnumGraphite, *cfg.GetAi().GetVersion(), swv, "", |
| 129 | ) |
| 130 | } |
| 131 | |
| 132 | return checkCLIVersion(ctx, ce, appVersion) |
| 133 | } |
| 134 | |
| 135 | func commandVersion(ctx context.Context, cmd *cli.Command) error { |
| 136 | ce := clienv.FromCLI(cmd) |
no test coverage detected