mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 15:28:42 +00:00
Add requirement for ssh issue credentials command to include either outFilePath or addToAgent flag
This commit is contained in:
+10
-6
@@ -235,6 +235,15 @@ func issueCredentials(cmd *cobra.Command, args []string) {
|
|||||||
util.HandleError(err, "Unable to parse flag")
|
util.HandleError(err, "Unable to parse flag")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addToAgent, err := cmd.Flags().GetBool("addToAgent")
|
||||||
|
if err != nil {
|
||||||
|
util.HandleError(err, "Unable to parse addToAgent flag")
|
||||||
|
}
|
||||||
|
|
||||||
|
if outFilePath == "" && addToAgent == false {
|
||||||
|
util.PrintErrorMessageAndExit("You must provide either --outFilePath or --addToAgent flag to use this command")
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
outputDir string
|
outputDir string
|
||||||
privateKeyPath string
|
privateKeyPath string
|
||||||
@@ -357,12 +366,7 @@ func issueCredentials(cmd *cobra.Command, args []string) {
|
|||||||
fmt.Println("Successfully wrote SSH certificate to:", signedKeyPath)
|
fmt.Println("Successfully wrote SSH certificate to:", signedKeyPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we need to add the key to the SSH agent
|
// Add SSH credentials to the SSH agent if needed
|
||||||
addToAgent, err := cmd.Flags().GetBool("addToAgent")
|
|
||||||
if err != nil {
|
|
||||||
util.HandleError(err, "Unable to parse addToAgent flag")
|
|
||||||
}
|
|
||||||
|
|
||||||
if addToAgent {
|
if addToAgent {
|
||||||
// Call the helper function to handle add-to-agent flow
|
// Call the helper function to handle add-to-agent flow
|
||||||
err := addCredentialsToAgent(creds.PrivateKey, creds.SignedKey)
|
err := addCredentialsToAgent(creds.PrivateKey, creds.SignedKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user