MCPcopy Create free account
hub / github.com/nhost/nhost / CheckVersions

Function CheckVersions

cli/cmd/software/version.go:88–133  ·  view source on GitHub ↗
(
	ctx context.Context,
	ce *clienv.CliEnv,
	cfg *model.ConfigConfig,
	appVersion string,
)

Source from the content-addressed store, hash-verified

86}
87
88func 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
135func commandVersion(ctx context.Context, cmd *cli.Command) error {
136 ce := clienv.FromCLI(cmd)

Callers 3

upFunction · 0.92
cloudFunction · 0.92
commandVersionFunction · 0.85

Calls 9

UnmarshalFileFunction · 0.92
checkServiceVersionFunction · 0.85
checkCLIVersionFunction · 0.85
SecretsMethod · 0.80
ErrorfMethod · 0.80
GetNhostPublicClientMethod · 0.80
GetHasuraMethod · 0.80
GetVersionMethod · 0.65
GetSoftwareVersionsMethod · 0.45

Tested by

no test coverage detected