Documentation
¶
Index ¶
- Constants
- func GenerateInstanceName(serviceType, version string, existingNames []string) string
- func NormalizeInstanceName(name string) string
- func ParseMemoryToBytes(mem string) (int64, error)
- func SanitizeCPULimit(limit string) (string, error)
- func SanitizeMemoryLimit(limit string) (string, error)
- func ValidateDomain(domain string) error
- func ValidateInstanceName(name string) error
- type Manager
- func (m *Manager) AddInstance(instance *types.Instance) error
- func (m *Manager) AddProject(project *types.Project) error
- func (m *Manager) CreateDefault() error
- func (m *Manager) Exists() bool
- func (m *Manager) Get() (*types.Config, error)
- func (m *Manager) GetCatalogDir() string
- func (m *Manager) GetCertsDir() string
- func (m *Manager) GetDokuDir() string
- func (m *Manager) GetDomain() (string, error)
- func (m *Manager) GetInstance(name string) (*types.Instance, error)
- func (m *Manager) GetProject(name string) (*types.Project, error)
- func (m *Manager) GetProjectsDir() string
- func (m *Manager) GetProtocol() (string, error)
- func (m *Manager) GetServicesDir() string
- func (m *Manager) GetTraefikDir() string
- func (m *Manager) HasInstance(name string) bool
- func (m *Manager) Initialize() error
- func (m *Manager) IsInitialized() bool
- func (m *Manager) ListInstances() ([]*types.Instance, error)
- func (m *Manager) Load() (*types.Config, error)
- func (m *Manager) RemoveInstance(name string) error
- func (m *Manager) RemoveProject(name string) error
- func (m *Manager) Save(config *types.Config) error
- func (m *Manager) SetDomain(domain string) error
- func (m *Manager) SetProtocol(protocol string) error
- func (m *Manager) Update(updateFn func(*types.Config) error) error
- func (m *Manager) UpdateCatalogVersion(version string) error
- func (m *Manager) UpdateInstance(name string, instance *types.Instance) error
- type Preferences
- func (p *Preferences) BuildInternalHostname(instanceName string) (string, error)
- func (p *Preferences) BuildServiceURL(instanceName string, useHTTPS bool) (string, error)
- func (p *Preferences) CatalogVersion() (string, error)
- func (p *Preferences) DNSSetup() (string, error)
- func (p *Preferences) Domain() (string, error)
- func (p *Preferences) GetAll() (*types.PreferencesConfig, error)
- func (p *Preferences) GetDefaultCPULimit() string
- func (p *Preferences) GetDefaultMemoryLimit() string
- func (p *Preferences) Protocol() (string, error)
- func (p *Preferences) SetDNSSetup(method string) error
- func (p *Preferences) SetDomain(domain string) error
- func (p *Preferences) SetProtocol(protocol string) error
Constants ¶
const ( DefaultDomain = "doku.local" DefaultProtocol = "https" ConfigFileName = "config.toml" DokuDirName = ".doku" )
Variables ¶
This section is empty.
Functions ¶
func GenerateInstanceName ¶
GenerateInstanceName generates a unique instance name
func NormalizeInstanceName ¶
NormalizeInstanceName converts a string to a valid instance name
func ParseMemoryToBytes ¶
ParseMemoryToBytes converts memory string to bytes (for comparison)
func SanitizeCPULimit ¶
SanitizeCPULimit validates and normalizes CPU limit strings
func SanitizeMemoryLimit ¶
SanitizeMemoryLimit validates and normalizes memory limit strings
func ValidateDomain ¶
ValidateDomain validates a domain name
func ValidateInstanceName ¶
ValidateInstanceName validates an instance name
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles configuration operations
func (*Manager) AddInstance ¶
AddInstance adds a new service instance to the configuration
func (*Manager) AddProject ¶
AddProject adds a new project to the configuration
func (*Manager) CreateDefault ¶
CreateDefault creates a default configuration file
func (*Manager) GetCatalogDir ¶
GetCatalogDir returns the path to the catalog directory
func (*Manager) GetCertsDir ¶
GetCertsDir returns the path to the certs directory
func (*Manager) GetDokuDir ¶
GetDokuDir returns the path to the .doku directory
func (*Manager) GetInstance ¶
GetInstance retrieves a service instance by name
func (*Manager) GetProject ¶
GetProject retrieves a project by name
func (*Manager) GetProjectsDir ¶
GetProjectsDir returns the path to the projects directory
func (*Manager) GetProtocol ¶
GetProtocol returns the configured protocol
func (*Manager) GetServicesDir ¶
GetServicesDir returns the path to the services directory
func (*Manager) GetTraefikDir ¶
GetTraefikDir returns the path to the traefik directory
func (*Manager) HasInstance ¶
HasInstance checks if an instance exists
func (*Manager) Initialize ¶
Initialize creates the Doku directory and default configuration
func (*Manager) IsInitialized ¶
IsInitialized checks if Doku has been initialized
func (*Manager) ListInstances ¶
ListInstances returns all service instances
func (*Manager) RemoveInstance ¶
RemoveInstance removes a service instance from the configuration
func (*Manager) RemoveProject ¶
RemoveProject removes a project from the configuration
func (*Manager) SetProtocol ¶
SetProtocol updates the protocol preference
func (*Manager) UpdateCatalogVersion ¶
UpdateCatalogVersion updates the catalog version and timestamp
type Preferences ¶
type Preferences struct {
// contains filtered or unexported fields
}
Preferences provides convenient access to preference settings
func NewPreferences ¶
func NewPreferences(manager *Manager) *Preferences
NewPreferences creates a new Preferences helper
func (*Preferences) BuildInternalHostname ¶
func (p *Preferences) BuildInternalHostname(instanceName string) (string, error)
BuildInternalHostname constructs the internal Docker hostname for a service
func (*Preferences) BuildServiceURL ¶
func (p *Preferences) BuildServiceURL(instanceName string, useHTTPS bool) (string, error)
BuildServiceURL constructs a URL for a service instance
func (*Preferences) CatalogVersion ¶
func (p *Preferences) CatalogVersion() (string, error)
CatalogVersion returns the current catalog version
func (*Preferences) DNSSetup ¶
func (p *Preferences) DNSSetup() (string, error)
DNSSetup returns the DNS setup method
func (*Preferences) Domain ¶
func (p *Preferences) Domain() (string, error)
Domain returns the configured domain
func (*Preferences) GetAll ¶
func (p *Preferences) GetAll() (*types.PreferencesConfig, error)
GetAll returns all preferences
func (*Preferences) GetDefaultCPULimit ¶
func (p *Preferences) GetDefaultCPULimit() string
GetDefaultCPULimit returns the default CPU limit for services
func (*Preferences) GetDefaultMemoryLimit ¶
func (p *Preferences) GetDefaultMemoryLimit() string
GetDefaultMemoryLimit returns the default memory limit for services
func (*Preferences) Protocol ¶
func (p *Preferences) Protocol() (string, error)
Protocol returns the configured protocol (http or https)
func (*Preferences) SetDNSSetup ¶
func (p *Preferences) SetDNSSetup(method string) error
SetDNSSetup sets the DNS setup method
func (*Preferences) SetDomain ¶
func (p *Preferences) SetDomain(domain string) error
SetDomain sets a new domain
func (*Preferences) SetProtocol ¶
func (p *Preferences) SetProtocol(protocol string) error
SetProtocol sets the protocol