cli

package
v0.1.83 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

README

Connection management

query connections manages reusable Connection files by default. New connections are saved under $XDG_CONFIG_HOME/flanksource/connections, or ~/.config/flanksource/connections when XDG_CONFIG_HOME is unset. Listing reads that directory, <config-dir>/connections, and ./.connections, with later layers overriding earlier definitions of the same namespace/name. Editing and deleting operate on the effective connection's original file. Removing an override can reveal a lower-priority connection.

query connections add postgres --name orders --namespace shop --host localhost:5432 --database orders --username tester --password 'secret://orders/password'
query connections add sqlite --name local --url file:records.db
query connections add http --name service -i
query connections list --type postgres --format json
query connections edit connection://shop/orders --url postgres://localhost:5432/orders
query connections edit local -i
query connections validate local
query connections delete local
query connections list --source=db --db embedded

--source accepts file (default) or db. File mode never opens the configured PostgreSQL database or reads profiles. Database mode uses --db, QUERY_DB_URL, or the default embedded Query database and does not include file connections. HTTP routes and the web app retain their existing persistence behavior.

add takes a connection type subcommand and --name; --namespace is optional. Provider flags follow Incident Commander's connection commands: SQL supports URL or host/database fields, cloud connections expose their credential fields, and HTTP supports basic, bearer, OAuth, and TLS credentials. --properties key=value adds provider-specific properties. edit applies supplied fields and preserves other fields and stored credentials. References accept IDs, unique names, and namespace/name or connection://namespace/name.

Use -i or --interactive for Clicky's terminal/dashboard forms. Add forms are seeded from supplied flags; edit forms load current values. Cancellation does not save. Literal passwords and certificates are omitted from responses; credential references remain stored for hydration at use time.

validate resolves credentials and performs a fresh read-only provider probe. It returns a nonzero exit on invalid configuration, missing references, authentication failures, unreachable targets, or unsupported checks. SQLite opens in read-only mode and must already exist. Unsupported connection types report an error; validation never sends notifications or writes artifacts. Listing never contacts connection targets.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnectionFromFlags

func BuildConnectionFromFlags(flags *ConnectionFlags) (models.Connection, error)

func New

func New(options Options) *cobra.Command

func Redact

func Redact(value any)

Redact removes credentials before a connection result crosses a process boundary.

Types

type ConnectionFlags

type ConnectionFlags struct {
	Name      string
	Namespace string
	Layer     string
	Type      string
	Test      bool
	DryRun    bool

	// Common fields
	URL         string
	Username    string
	Password    string
	Certificate string
	InsecureTLS bool

	// Kubernetes
	Kubeconfig string

	// AWS
	AccessKey    string
	SecretKey    string
	Region       string
	Profile      string
	FromProfile  string
	SessionToken string

	// AWS KMS / GCP KMS / Azure Key Vault
	KeyID string

	// S3 / GCS
	Bucket       string
	UsePathStyle bool

	// Azure
	ClientID     string
	ClientSecret string
	TenantID     string

	// Azure DevOps
	Organization        string
	PersonalAccessToken string

	// Git
	Ref string

	// Slack
	Channel  string
	Token    string
	BotName  string
	Color    string
	Icon     string
	ThreadTS string
	Title    string

	// SMTP
	Host        string
	Port        int
	FromAddress string
	FromName    string
	ToAddresses []string
	Subject     string
	Auth        string
	Encryption  string

	// Telegram / Ntfy
	Chats string
	Topic string

	// Pushbullet / Pushover
	Targets []string
	User    string

	// Discord
	WebhookID string

	// SFTP / SMB
	Path  string
	Share string

	// Mongo
	ReplicaSet string

	// MSSQL
	TrustServerCertificate bool

	// Database common
	Database string

	// HTTP / Prometheus auth
	Bearer            string
	OAuthClientID     string
	OAuthClientSecret string
	OAuthTokenURL     string
	OAuthScopes       string
	TLSCA             string
	TLSCert           string
	TLSKey            string

	// Facet
	TimestampURL string

	// AI models
	Model  string
	ApiKey string

	// Properties (generic key=value pairs)
	Properties []string
}

type Options

type Options struct {
	Open    func(context.Context, string) (Backend, func() error, error)
	Sources []string
}

Jump to

Keyboard shortcuts

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