Skip to content

Commit

Permalink
add tailscale check
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Jan 23, 2025
1 parent ea9607f commit 6cc9e4a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/ctrlc/root/sync/tailscale/tailscale.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ func NewSyncTailscaleCmd() *cobra.Command {
Example: heredoc.Doc(`
$ ctrlc sync tailscale --workspace 2a7c5560-75c9-4dbe-be74-04ee33bf8188
`),
PreRunE: func(cmd *cobra.Command, args []string) error {
if tailscaleApiKey == "" && (tailscaleOauthClientId == "" || tailscaleOauthClientSecret == "") {
return fmt.Errorf("either tailscale-key or tailscale-oauth-id and tailscale-oauth-secret must be provided")
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
log.Info("Syncing Tailscale VMs into Ctrlplane")

Expand Down Expand Up @@ -159,7 +165,6 @@ func NewSyncTailscaleCmd() *cobra.Command {
cmd.Flags().StringVarP(&tailscaleApiKey, "tailscale-key", "k", os.Getenv("TAILSCALE_API_KEY"), "The API key to use")

cmd.MarkFlagRequired("tailnet")
cmd.MarkFlagRequired("tailscale-key")

cmd.Flags().StringVarP(&tailscaleOauthClientId, "tailscale-oauth-id", "c", os.Getenv("TAILSCALE_OAUTH_CLIENT_ID"), "The OAuth client ID to use")
cmd.Flags().StringVarP(&tailscaleOauthClientSecret, "tailscale-oauth-secret", "s", os.Getenv("TAILSCALE_OAUTH_CLIENT_SECRET"), "The OAuth client secret to use")
Expand Down

0 comments on commit 6cc9e4a

Please sign in to comment.