cmd

package
v0.0.0-...-a2939b6 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cmd contains helpers common to all CLI implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bust

type Bust struct {
	PGConfig
	LogConfig
	CloudflareConfig

	AuthorID int64 `arg:"" help:"author ID to cache bust"`
}

Bust allows manually busting entries from the CLI.

func (*Bust) Run

func (b *Bust) Run() error

Run busts a cache key.

type CloudflareConfig

type CloudflareConfig struct {
	CloudflareToken  string `and:"cf" help:"API token (not a legacy global API key) with permission to bust caches."`
	CloudflareZoneID string `and:"cf" help:"The Cloudflare zone ID"`
	CloudflareDomain string `and:"cf" help:"The domain name for constructing URLs to bust."`
}

CloudflareConfig is optional and configures Cloudflare for cache busting.

func (*CloudflareConfig) Cache

Cache returns the cloudflare cache, if it was configured, or nil otherwise.

type LogConfig

type LogConfig struct {
	Verbose bool `env:"VERBOSE" help:"increase log verbosity"`
}

LogConfig configures logging.

func (*LogConfig) Run

func (c *LogConfig) Run() error

Run sets logging to DEBUG if verbose is enabled.

type PGConfig

type PGConfig struct {
	PostgresHost         string `default:"localhost" env:"POSTGRES_HOST" help:"Postgres host."`
	PostgresUser         string `default:"postgres" env:"POSTGRES_USER" help:"Postgres user."`
	PostgresPassword     string `xor:"db-auth" env:"POSTGRES_PASSWORD" help:"Postgres password."`
	PostgresPasswordFile []byte `type:"filecontent" xor:"db-auth" env:"POSTGRES_PASSWORD_FILE" help:"File with the Postgres password."`
	PostgresPort         int    `default:"5432" env:"POSTGRES_PORT" help:"Postgres port."`
	PostgresDatabase     string `default:"rreading-glasses" env:"POSTGRES_DATABASE" help:"Postgres database to use."`
}

PGConfig configured a PostGres connection.

func (*PGConfig) DSN

func (c *PGConfig) DSN() string

DSN returns the database's DSN based on the provided flags.

Directories

Path Synopsis
Package main runs a metadata server using G——R—— as an upstream.
Package main runs a metadata server using G——R—— as an upstream.
Package main runs a metadata server using Hardcover as an upstream.
Package main runs a metadata server using Hardcover as an upstream.

Jump to

Keyboard shortcuts

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