diff --git a/cmd/root.go b/cmd/root.go index c2f0633..48bd7d2 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -141,3 +141,16 @@ func loadConfigFromFile(appFileName string) (*v1.RadixApplication, error) { return radixApplication, nil } + +func getStringFromFlagValueOrFlagFile(cmd *cobra.Command, valueFlag, fileNameFlag string) (string, error) { + fileName, err := cmd.Flags().GetString(fileNameFlag) + if err != nil { + return "", err + } + if len(fileName) > 0 { + fileContent, err := os.ReadFile(fileName) + return string(fileContent), err + } + + return cmd.Flags().GetString(valueFlag) +} diff --git a/cmd/setExternalDnsTls.go b/cmd/setExternalDnsTls.go index 8323b7d..eaa895e 100644 --- a/cmd/setExternalDnsTls.go +++ b/cmd/setExternalDnsTls.go @@ -138,17 +138,6 @@ func isComponentExternalDNSReconciled(apiClient *apiclient.Radixapi, appName, en return false } -func getStringFromFlagValueOrFlagFile(cmd *cobra.Command, valueFlag, fileNameFlag string) (string, error) { - if fileName, err := cmd.Flags().GetString(fileNameFlag); err != nil { - return "", err - } else if len(fileName) > 0 { - fileContent, err := os.ReadFile(fileName) - return string(fileContent), err - } - - return cmd.Flags().GetString(valueFlag) -} - func init() { setExternalDnsTlsCmd.Flags().StringP(flagnames.Application, "a", "", "Name of the application") setExternalDnsTlsCmd.Flags().StringP(flagnames.Environment, "e", "", "Name of the environment")