mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
f83a8e591f
Rename the admin secret key header used to access GraphQL engine from X-Hasura-Access-Key to X-Hasura-Admin-Secret. Server CLI and console all support the older flag but marks it as deprecated.
33 lines
853 B
Go
33 lines
853 B
Go
package commands
|
|
|
|
import (
|
|
"github.com/hasura/graphql-engine/cli"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
// NewVersionCmd returns the version command
|
|
func NewVersionCmd(ec *cli.ExecutionContext) *cobra.Command {
|
|
versionCmd := &cobra.Command{
|
|
Use: "version",
|
|
Short: "Print the CLI version",
|
|
SilenceUsage: true,
|
|
PreRunE: func(cmd *cobra.Command, args []string) error {
|
|
ec.Viper = viper.New()
|
|
return ec.Prepare()
|
|
},
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
ec.Logger.WithField("version", ec.Version.GetCLIVersion()).Info("hasura cli")
|
|
err := ec.Validate()
|
|
if err == nil {
|
|
ec.Logger.
|
|
WithField("endpoint", ec.ServerConfig.Endpoint).
|
|
WithField("version", ec.Version.GetServerVersion()).
|
|
Info("hasura graphql engine")
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
return versionCmd
|
|
}
|