github.com/supabase/cli@v1.168.1/internal/ssl_enforcement/get/get.go (about)

     1  package get
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/go-errors/errors"
     8  	"github.com/spf13/afero"
     9  	"github.com/supabase/cli/internal/utils"
    10  )
    11  
    12  func Run(ctx context.Context, projectRef string, fsys afero.Fs) error {
    13  	// 1. Sanity checks.
    14  	// 2. get ssl enforcement config
    15  	{
    16  		resp, err := utils.GetSupabase().GetSslEnforcementConfigWithResponse(ctx, projectRef)
    17  		if err != nil {
    18  			return errors.Errorf("failed to retrieve SSL enforcement config: %w", err)
    19  		}
    20  		if resp.JSON200 == nil {
    21  			return errors.New("failed to retrieve SSL enforcement config; received: " + string(resp.Body))
    22  		}
    23  
    24  		if resp.JSON200.CurrentConfig.Database && resp.JSON200.AppliedSuccessfully {
    25  			fmt.Println("SSL is being enforced.")
    26  		} else {
    27  			fmt.Println("SSL is *NOT* being enforced.")
    28  		}
    29  		return nil
    30  	}
    31  }