cc

package
v0.33.11 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusNotRunning runStatus = iota
	StatusRunning
)

Variables

View Source
var (
	ErrNotRunning = errors.New("topaz is not running, use 'topaz start' or 'topaz run' to start")
	ErrIsRunning  = errors.New("topaz is already running, use 'topaz stop' to stop")
)

Functions

func AuthorizerKey

func AuthorizerKey() string

func AuthorizerSvc

func AuthorizerSvc() string

func AuthorizerToken

func AuthorizerToken() string

func Container

func Container(registry, image, tag string) string

Container returns the fully qualified container name (registry/image:tag).

func ContainerImage

func ContainerImage() string

ContainerImage returns the container image name.

func ContainerName

func ContainerName(defaultConfigFile string) string

ContainerName returns the container instance name (docker run --name CONTAINER_NAME).

func ContainerPlatform

func ContainerPlatform() string

ContainerPlatform, returns the container platform for multi-platform capable servers.

func ContainerRegistry

func ContainerRegistry() string

ContainerRegistry returns the container registry (host[:port]/repo).

func ContainerTag

func ContainerTag() string

ContainerTag returns the container tag (label or semantic version).

func ContainerVersionTag

func ContainerVersionTag(version, tag string) string

ContainerVersionTag consolidates the old --container-version with the --container-tag value, the command handlers will read the environment variable versions $CONTAINER_VERSION and $CONTAINER_TAG, which is why they are not explicitly handled in this function.

func DirectoryKey

func DirectoryKey() string

func DirectorySvc

func DirectorySvc() string

func DirectoryToken

func DirectoryToken() string

func EnsureDirs

func EnsureDirs() error

func EnsureTopazCertsDir

func EnsureTopazCertsDir() error

func EnsureTopazCfgDir

func EnsureTopazCfgDir() error

func EnsureTopazDataDir

func EnsureTopazDataDir() error

func EnsureTopazDir

func EnsureTopazDir() error

func EnsureTopazTemplateDir

func EnsureTopazTemplateDir() error

func GetTopazCertsDir

func GetTopazCertsDir() string

GetTopazCertsDir returns the topaz certs directory ($XDG_DATA_HOME/topaz/certs).

func GetTopazCfgDir

func GetTopazCfgDir() string

GetTopazCfgDir returns the topaz config directory ($XDG_CONFIG_HOME/topaz/cfg).

func GetTopazDataDir

func GetTopazDataDir() string

GetTopazDataDir returns the topaz db directory ($XDG_DATA_HOME/topaz/db).

func GetTopazDir

func GetTopazDir() string

GetTopazDir returns the topaz root directory ($HOME/.config/topaz).

func GetTopazTemplateDir

func GetTopazTemplateDir() string

GetTopazTemplateDir returns the templates installation directory ($XDG_DATA_HOME/topaz/tmpl).

func GetTopazTemplateURL

func GetTopazTemplateURL() string

GetTopazTemplateURL returns the URL to the templates container, can be local or remote.

func Insecure

func Insecure() bool

func NoCheck

func NoCheck() bool

func NoColor

func NoColor() bool

func Plaintext

func Plaintext() bool

func Retry

func Retry(timeout, interval time.Duration, f func() error) error

func ServiceHealthStatus

func ServiceHealthStatus(ctx context.Context, cfg *client.Config, service string) (bool, error)

ServiceHealthStatus adopted from grpc-health-probe cli implementation https://github.com/grpc-ecosystem/grpc-health-probe/blob/master/main.go.

func Timeout

func Timeout() time.Duration

func WaitForPorts

func WaitForPorts(ports []string, expectedStatus PortStatus) error

Types

type ActiveConfig

type ActiveConfig struct {
	Config     string `json:"config"`
	ConfigFile string `json:"config_file"`
}

type CLIConfig

type CLIConfig struct {
	Version  int            `json:"version"`
	Active   ActiveConfig   `json:"active"`
	Running  RunningConfig  `json:"running"`
	Defaults DefaultsConfig `json:"defaults"`
}

type CommonCtx

type CommonCtx struct {
	Context context.Context

	Config *CLIConfig
	// contains filtered or unexported fields
}

func NewCommonContext

func NewCommonContext(ctx context.Context, noCheck bool, configFilePath string) (*CommonCtx, error)

func (*CommonCtx) CheckRunStatus

func (c *CommonCtx) CheckRunStatus(containerName string, expectedStatus runStatus) bool

func (*CommonCtx) Con

func (c *CommonCtx) Con() *ConMsg

Con() - console message send to StdErr, default no-color.

func (*CommonCtx) GetRunningContainers

func (c *CommonCtx) GetRunningContainers() ([]container.Summary, error)

func (*CommonCtx) Out

func (c *CommonCtx) Out() *ConMsg

Out() - console output message send to StdOut, default no-color.

func (*CommonCtx) SaveContextConfig

func (c *CommonCtx) SaveContextConfig(configurationFile string) error

func (*CommonCtx) StdErr

func (c *CommonCtx) StdErr() *os.File

func (*CommonCtx) StdOut

func (c *CommonCtx) StdOut() *os.File

type ConMsg

type ConMsg struct {
	// contains filtered or unexported fields
}

ConMsg - console message, send either StdErr or StdOut.

func (*ConMsg) Error

func (cm *ConMsg) Error() *ConMsg

Error() - error console message (red).

func (*ConMsg) Info

func (cm *ConMsg) Info() *ConMsg

Info() - info console message (green).

func (*ConMsg) Msg

func (cm *ConMsg) Msg(message string, args ...any)

Msg() - sends the con|out message, by default adds a CrLr when not present.

func (*ConMsg) Warn

func (cm *ConMsg) Warn() *ConMsg

Warn() - warning console message (yellow).

type DefaultsConfig

type DefaultsConfig struct {
	NoCheck           bool   `json:"no_check"`
	NoColor           bool   `json:"no_color"`
	ContainerRegistry string `json:"container_registry"`
	ContainerImage    string `json:"container_image"`
	ContainerTag      string `json:"container_tag"`
	ContainerPlatform string `json:"container_platform"`
}

type PortStatus

type PortStatus int
const (
	PortOpened PortStatus = iota
	PortClosed
)

func (PortStatus) String

func (p PortStatus) String() string

type RunningConfig

type RunningConfig struct {
	ActiveConfig

	ContainerName string `json:"container_name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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