common

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package common holds flag structs and helpers shared between the `coolify init` and `coolify firewall` command trees. Kept intentionally small: only cross-command plumbing (SSH mesh flags, namespace validation) lives here.

Package common hosts flag sets and helpers shared between multiple top-level commands that SSH into a list of servers (init, firewall, ...).

Index

Constants

View Source
const DefaultNamespace = "default"

DefaultNamespace is the namespace used when the user does not pass --namespaces. It is also always present (implicitly) so existing workflows and coold defaults keep working.

Variables

This section is empty.

Functions

func BindMeshNetMultiFlags

func BindMeshNetMultiFlags(cmd *cobra.Command, f *MeshNetFlags)

BindMeshNetMultiFlags registers --namespaces/--container-pool/--container-prefix on cmd (init-style: many namespaces per invocation).

func BindMeshNetSingleFlags

func BindMeshNetSingleFlags(cmd *cobra.Command, ns *string)

BindMeshNetSingleFlags registers --namespace on cmd (firewall-style: one namespace per invocation).

func BindSSHMeshFlags

func BindSSHMeshFlags(cmd *cobra.Command, f *SSHMeshFlags)

BindSSHMeshFlags registers the shared flags as PersistentFlags on cmd.

func BindVolumeBackupScheduleFlags

func BindVolumeBackupScheduleFlags(cmd *cobra.Command)

BindVolumeBackupScheduleFlags registers flags shared by storage backup schedule set commands.

func BuildVolumeBackupScheduleRequest

func BuildVolumeBackupScheduleRequest(cmd *cobra.Command) (models.VolumeBackupScheduleRequest, error)

BuildVolumeBackupScheduleRequest builds a PUT body from flags.

func PodmanNetworkFor

func PodmanNetworkFor(ns string) string

PodmanNetworkFor returns the podman bridge network name that backs namespace ns on every host. Derived as `coolify-<ns>-mesh` so the namespace name is visible in `podman network ls`.

func ValidateNamespace

func ValidateNamespace(ns string) error

ValidateNamespace validates a single namespace value (used by the firewall command's --namespace flag).

Types

type MeshNetFlags

type MeshNetFlags struct {
	// Namespaces enumerates every namespace the mesh should carry. At least
	// one entry is required; the first element is the implicit "default"
	// unless the user overrides it.
	Namespaces []string

	// ContainerPool is the shared address pool every namespace carves its
	// per-host /<ContainerPrefix> from. One pool covers all namespaces;
	// subnets never overlap.
	ContainerPool string

	// ContainerPrefix is the prefix length of each per-host, per-namespace
	// container subnet (default 24 → 254 container IPs per host per ns).
	ContainerPrefix int
}

MeshNetFlags holds the flag set shared between `coolify init` (which creates per-namespace podman networks on every host) and `coolify firewall` (which talks to coold about per-namespace rules).

`init` binds it as a slice so a single command sets up the entire cluster; `firewall` binds it as a single value since each allow/revoke/list call operates on one namespace at a time.

func (*MeshNetFlags) ValidateNamespaces

func (f *MeshNetFlags) ValidateNamespaces() error

ValidateNamespaces checks that every namespace is a valid DNS label and that the list has no duplicates.

type SSHMeshFlags

type SSHMeshFlags struct {
	Servers             []string
	SSHKey              string
	SSHUser             string
	SSHPort             int
	SSHPassphrasePrompt bool
	Concurrency         int
	SSHTimeout          string
}

SSHMeshFlags holds the flags shared by every command that fans out over a list of SSH-reachable servers (coolify init, coolify firewall, ...).

func (*SSHMeshFlags) BuildSSHClient

func (f *SSHMeshFlags) BuildSSHClient() (*internalssh.Client, error)

BuildSSHClient creates an SSH client, resolving any key passphrase first.

func (*SSHMeshFlags) ParseSSHTimeout

func (f *SSHMeshFlags) ParseSSHTimeout() time.Duration

ParseSSHTimeout parses SSHTimeout, falling back to 30s on error/zero.

func (*SSHMeshFlags) ResolvePassphrase

func (f *SSHMeshFlags) ResolvePassphrase() ([]byte, error)

ResolvePassphrase returns the SSH key passphrase in this priority order:

  1. COOLIFY_SSH_PASSPHRASE env var
  2. Interactive prompt when --ssh-passphrase-prompt is set
  3. nil (no passphrase)

func (*SSHMeshFlags) Validate

func (f *SSHMeshFlags) Validate() error

Validate checks that the required flags are set.

Jump to

Keyboard shortcuts

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