cli

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteSecret

func DeleteSecret(ctx context.Context, orgID, environment, name string) error

DeleteSecret deletes a secret. If name is empty, prompts the user interactively with a confirmation step.

func FetchSecrets

func FetchSecrets(ctx context.Context, orgID, environment string, names []string, fetchAll bool) error

FetchSecrets retrieves multiple secrets securely and prints them to stdout.

func GetActiveOrg

func GetActiveOrg() (string, error)

GetActiveOrg retrieves the currently active organization from the configuration file.

func GetLastCheck

func GetLastCheck() time.Time

GetLastCheck returns the time of the last update check.

func GetProfile

func GetProfile(ctx context.Context) (*cratev1.GetProfileResponse, error)

GetProfile retrieves the user profile and their organizations via the gRPC connect endpoint.

func GetSecret

func GetSecret(ctx context.Context, orgID, environment, name string) error

GetSecret retrieves a secret using sealed transport. If name is empty, prompts the user interactively.

func ListSecrets

func ListSecrets(ctx context.Context, orgID, environment string) error

ListSecrets lists all secrets for the given organization and environment.

func LoadEnvFile added in v1.0.4

func LoadEnvFile(filename string) (map[string]string, error)

LoadEnvFile reads a key-value .env file and returns a map of environment variables. It skips empty lines, comments (lines starting with #), and trims surrounding quotes from values.

func Login

func Login(ctx context.Context, endpoint string) error

Login performs the OAuth2 flow to authenticate the CLI.

func Logout

func Logout(ctx context.Context) error

Logout removes the CLI configuration, effectively logging the user out.

func RetrieveSecrets

func RetrieveSecrets(ctx context.Context, orgID, environment string, names []string, fetchAll bool) (map[string]string, error)

RetrieveSecrets retrieves multiple secrets securely and returns them as a map. If fetchAll is true or --names is provided, skips prompting (ideal for CI/deploy). Otherwise, prompts the user to choose between fetching all or entering specific names.

func SetActiveOrg

func SetActiveOrg(orgID string) error

SetActiveOrg saves the given organization ID to the configuration file.

func StoreSecret

func StoreSecret(ctx context.Context, orgID, environment, name, value string) error

StoreSecret stores a secret using sealed transport. If name or value are empty, prompts the user interactively.

func UpdateLastCheck

func UpdateLastCheck(t time.Time) error

UpdateLastCheck updates the LastUpdateCheck timestamp in the config.

func ValidateConfig

func ValidateConfig(ctx context.Context, filename string) error

ValidateConfig validates the provided configuration file against the system models.

Types

type Config

type Config struct {
	AccessToken     string    `json:"access_token"`
	Endpoint        string    `json:"endpoint"`
	ActiveOrg       string    `json:"active_org,omitempty"`
	LastUpdateCheck time.Time `json:"last_update_check,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL