Documentation
¶
Index ¶
- Variables
- func CheckSSHPass(profileDir string) (bool, error)
- func CheckTools(tools ...string) []string
- func DBServiceCompose(s ResolvedDBService) map[string]any
- func DBServiceDSN(s ResolvedDBService) string
- func DeepMerge(base, extra map[string]any) map[string]any
- func DockerfileShortcut(cfg *Config, profileDir string, image string) string
- func ExpandPlaceholders(v any, mapping map[string]string) any
- func ExpandServicePlaceholders(services map[string]any) map[string]any
- func ManagedServiceNames(cfg *Config, serviceName string) map[string]bool
- func MergeRemoteCompose(remote *Remote, composeRemote string, generated map[string]any, ...) map[string]any
- func NewCheckCommand() *cc.Command
- func NewCommand() *cc.Command
- func NewInitCommand() *cc.Command
- func NewRunCommand() *cc.Command
- func NewSampleConfigCommand() *cc.Command
- func NewStatusCommand() *cc.Command
- func NewVersionCommand() *cc.Command
- func ParseSyncEntry(entry string, profileDir string) (localPath, remoteRel string, err error)
- func Publish(profile, pubDir string, noBuild, noSync bool) error
- func RenderCompose(cfg *Config, image, serviceName, appUser string, extra map[string]any) map[string]any
- func ResolveProfile(pubDir, profile string) (profileDir string, err error)
- func SetProfile(name string)
- func VersionString() string
- type AppConfig
- type Config
- type DBServiceConfig
- type ImageConfig
- type PortMapping
- type Remote
- func (r *Remote) Capture(remoteCmd string) string
- func (r *Remote) Exists(remotePath string) bool
- func (r *Remote) Run(remoteCmd string) error
- func (r *Remote) RunScript(remoteDir, script string) error
- func (r *Remote) Tunnel(localPort, remotePort int, remoteHost ...string) (func(), error)
- func (r *Remote) Upload(localPath, remotePath string) error
- type RemoteConfig
- type ResolvedDBService
- type SSHConfig
Constants ¶
This section is empty.
Variables ¶
var ( CommitID = "unknown" CommitTime = "unknown" BranchName = "unknown" )
Build-time injected via -ldflags -X.
var SCRIPT_DIR string
SCRIPT_DIR is the repo root directory.
Functions ¶
func CheckSSHPass ¶
CheckSSHPass checks whether the profile config at profileDir has a non-empty password field. It mimics the bash grep used by publish.sh.
func CheckTools ¶
CheckTools returns the list of missing tool names from the given list.
func DBServiceCompose ¶
func DBServiceCompose(s ResolvedDBService) map[string]any
DBServiceCompose builds the compose service definition for a DB service.
func DBServiceDSN ¶
func DBServiceDSN(s ResolvedDBService) string
DBServiceDSN returns the DATABASE_URL for a resolved DB service.
func DeepMerge ¶
DeepMerge recursively merges extra into base (extra wins). Nested maps are merged; lists and scalars are replaced. List-merge markers (leading/trailing "+") are supported.
func DockerfileShortcut ¶
DockerfileShortcut expands the app Dockerfile shortcut. Returns a sync_files entry ("LOCAL:REMOTE") or empty string.
func ExpandPlaceholders ¶
ExpandPlaceholders recursively replaces placeholder substrings in strings within value (a string, map, or slice). Dict keys are left untouched.
func ExpandServicePlaceholders ¶
ExpandServicePlaceholders expands $NAME and $VOLS in every service definition.
func ManagedServiceNames ¶
ManagedServiceNames returns the compose service keys the publisher owns.
func MergeRemoteCompose ¶
func MergeRemoteCompose(remote *Remote, composeRemote string, generated map[string]any, managedNames map[string]bool) map[string]any
MergeRemoteCompose updates an existing remote compose in place.
func NewCheckCommand ¶
NewCheckCommand returns the "check" subcommand.
func NewCommand ¶
NewCommand returns the root pub command — a dispatcher with subcommands.
func NewInitCommand ¶
NewInitCommand returns the "init" subcommand that scaffolds a new profile.
func NewSampleConfigCommand ¶
NewSampleConfigCommand returns a subcommand that prints the embedded config.example.yaml to stdout.
func NewStatusCommand ¶
NewStatusCommand returns the "status" subcommand that checks remote status.
func NewVersionCommand ¶
NewVersionCommand returns the "version" subcommand.
func ParseSyncEntry ¶
ParseSyncEntry parses a sync_files entry "[BKP:]LOCAL_PATH[:REMOTE_PATH]".
func RenderCompose ¶
func RenderCompose(cfg *Config, image, serviceName, appUser string, extra map[string]any) map[string]any
RenderCompose builds the remote compose file as a nested map.
func ResolveProfile ¶
ResolveProfile checks that the profile exists under pubDir/profiles/<name> and returns the profile directory path.
func SetProfile ¶
func SetProfile(name string)
SetProfile sets the active profile name shown in log lines.
func VersionString ¶
func VersionString() string
VersionString returns a single-line version string suitable for --version flag or logging.
Types ¶
type AppConfig ¶
type AppConfig struct {
Port any `yaml:"port"`
ServiceName string `yaml:"service_name,omitempty"`
User string `yaml:"user,omitempty"`
Build any `yaml:"build,omitempty"`
Dockerfile string `yaml:"dockerfile,omitempty"`
Tunnel bool `yaml:"tunnel,omitempty"`
PublicURL string `yaml:"public_url,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
Compose map[string]any `yaml:"compose,omitempty"`
ContainerName string `yaml:"container_name,omitempty"`
}
type Config ¶
type Config struct {
SSH SSHConfig `yaml:"ssh"`
Remote RemoteConfig `yaml:"remote"`
App AppConfig `yaml:"app"`
Image *ImageConfig `yaml:"image,omitempty"`
Hooks map[string]string `yaml:"hooks,omitempty"`
SyncFiles []string `yaml:"sync_files,omitempty"`
Networks map[string]any `yaml:"networks,omitempty"`
PostgresService *DBServiceConfig `yaml:"postgres_service,omitempty"`
MySQLService *DBServiceConfig `yaml:"mysql_service,omitempty"`
}
func LoadConfig ¶
LoadConfig reads config.yaml from the profile directory and deep-merges config.secrets.yaml if present.
type DBServiceConfig ¶
type DBServiceConfig struct {
Enabled bool `yaml:"enabled"`
ServiceName string `yaml:"service_name,omitempty"`
Up *bool `yaml:"up,omitempty"`
AppDBURL bool `yaml:"app_database_url,omitempty"`
User string `yaml:"user,omitempty"`
Password string `yaml:"password,omitempty"`
DB string `yaml:"db,omitempty"`
}
type ImageConfig ¶
type PortMapping ¶
PortMapping holds the compose ports entry and the published host port.
func AppPortMapping ¶
func AppPortMapping(port any) PortMapping
AppPortMapping interprets app.port for the compose ports and tunnel.
type Remote ¶
type Remote struct {
Host string
Port string
User string
Key string
Password string
// contains filtered or unexported fields
}
Remote wraps SSH/SCP operations against a configured host.
type RemoteConfig ¶
type RemoteConfig struct {
Dir string `yaml:"dir"`
}
type ResolvedDBService ¶
type ResolvedDBService struct {
Name string
Up bool
AppDBURL bool
Kind string
Image string
DataPath string
User string
Password string
DB string
}
ResolvedDBService holds the resolved settings for a bundled database service.
func ResolveDBServices ¶
func ResolveDBServices(cfg *Config) []ResolvedDBService
ResolveDBServices reads the postgres_service / mysql_service sections.