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
- func BindMeshNetMultiFlags(cmd *cobra.Command, f *MeshNetFlags)
- func BindMeshNetSingleFlags(cmd *cobra.Command, ns *string)
- func BindSSHMeshFlags(cmd *cobra.Command, f *SSHMeshFlags)
- func BindVolumeBackupScheduleFlags(cmd *cobra.Command)
- func BuildVolumeBackupScheduleRequest(cmd *cobra.Command) (models.VolumeBackupScheduleRequest, error)
- func PodmanNetworkFor(ns string) string
- func ValidateNamespace(ns string) error
- type MeshNetFlags
- type SSHMeshFlags
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
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:
- COOLIFY_SSH_PASSPHRASE env var
- Interactive prompt when --ssh-passphrase-prompt is set
- nil (no passphrase)
func (*SSHMeshFlags) Validate ¶
func (f *SSHMeshFlags) Validate() error
Validate checks that the required flags are set.