Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "login", Short: "Authenticate with Akita.", Long: `The CLI will prompt you to enter information for your Akita API key. API key information will be stored in ` + cfg.GetCredentialsConfigPath(), SuggestFor: []string{"signin", "sign-in", "log-in"}, SilenceUsage: true, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) error { ans := struct { APIKeyID string APIKeySecret string }{} if checkCreds { return testCredentials() } else { qs := []*survey.Question{ { Name: "APIKeyID", Prompt: &survey.Input{Message: "API Key ID:"}, }, { Name: "APIKeySecret", Prompt: &survey.Password{Message: "API Key Secret:"}, }, } if err := survey.Ask(qs, &ans); err != nil { return errors.Wrap(err, "failed to get API key ID and secret") } if err := cfg.WriteAPIKeyAndSecret("default", ans.APIKeyID, ans.APIKeySecret); err != nil { return errors.Wrap(err, "failed to save credentials config file") } fmt.Println("API keys stored in", cfg.GetCredentialsConfigPath()) err := testCredentials() if err == nil { envId := os.Getenv("AKITA_API_KEY_ID") envSecret := os.Getenv("AKITA_API_KEY_SECRET") idIsOverridden := envId != "" && envId != ans.APIKeyID secretIsOverridden := envSecret != "" && envSecret != ans.APIKeySecret if idIsOverridden || secretIsOverridden { fmt.Printf("[WARNING] Login credentials are currently overridden by the AKITA_API_KEY_ID and AKITA_API_KEY_SECRET environment variables.\n") } } return err } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.