config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDomain   = "doku.local"
	DefaultProtocol = "https"
	ConfigFileName  = "config.toml"
	DokuDirName     = ".doku"
)

Variables

This section is empty.

Functions

func GenerateInstanceName

func GenerateInstanceName(serviceType, version string, existingNames []string) string

GenerateInstanceName generates a unique instance name

func NormalizeInstanceName

func NormalizeInstanceName(name string) string

NormalizeInstanceName converts a string to a valid instance name

func ParseMemoryToBytes

func ParseMemoryToBytes(mem string) (int64, error)

ParseMemoryToBytes converts memory string to bytes (for comparison)

func SanitizeCPULimit

func SanitizeCPULimit(limit string) (string, error)

SanitizeCPULimit validates and normalizes CPU limit strings

func SanitizeMemoryLimit

func SanitizeMemoryLimit(limit string) (string, error)

SanitizeMemoryLimit validates and normalizes memory limit strings

func ValidateDomain

func ValidateDomain(domain string) error

ValidateDomain validates a domain name

func ValidateInstanceName

func ValidateInstanceName(name string) error

ValidateInstanceName validates an instance name

Types

type Manager

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

Manager handles configuration operations

func New

func New() (*Manager, error)

New creates a new configuration manager

func (*Manager) AddInstance

func (m *Manager) AddInstance(instance *types.Instance) error

AddInstance adds a new service instance to the configuration

func (*Manager) AddProject

func (m *Manager) AddProject(project *types.Project) error

AddProject adds a new project to the configuration

func (*Manager) CreateDefault

func (m *Manager) CreateDefault() error

CreateDefault creates a default configuration file

func (*Manager) Exists

func (m *Manager) Exists() bool

Exists checks if the configuration file exists

func (*Manager) Get

func (m *Manager) Get() (*types.Config, error)

Get returns the current configuration (loads if not cached)

func (*Manager) GetCatalogDir

func (m *Manager) GetCatalogDir() string

GetCatalogDir returns the path to the catalog directory

func (*Manager) GetCertsDir

func (m *Manager) GetCertsDir() string

GetCertsDir returns the path to the certs directory

func (*Manager) GetDokuDir

func (m *Manager) GetDokuDir() string

GetDokuDir returns the path to the .doku directory

func (*Manager) GetDomain

func (m *Manager) GetDomain() (string, error)

GetDomain returns the configured domain

func (*Manager) GetInstance

func (m *Manager) GetInstance(name string) (*types.Instance, error)

GetInstance retrieves a service instance by name

func (*Manager) GetProject

func (m *Manager) GetProject(name string) (*types.Project, error)

GetProject retrieves a project by name

func (*Manager) GetProjectsDir

func (m *Manager) GetProjectsDir() string

GetProjectsDir returns the path to the projects directory

func (*Manager) GetProtocol

func (m *Manager) GetProtocol() (string, error)

GetProtocol returns the configured protocol

func (*Manager) GetServicesDir

func (m *Manager) GetServicesDir() string

GetServicesDir returns the path to the services directory

func (*Manager) GetTraefikDir

func (m *Manager) GetTraefikDir() string

GetTraefikDir returns the path to the traefik directory

func (*Manager) HasInstance

func (m *Manager) HasInstance(name string) bool

HasInstance checks if an instance exists

func (*Manager) Initialize

func (m *Manager) Initialize() error

Initialize creates the Doku directory and default configuration

func (*Manager) IsInitialized

func (m *Manager) IsInitialized() bool

IsInitialized checks if Doku has been initialized

func (*Manager) ListInstances

func (m *Manager) ListInstances() ([]*types.Instance, error)

ListInstances returns all service instances

func (*Manager) Load

func (m *Manager) Load() (*types.Config, error)

Load reads the configuration from disk

func (*Manager) RemoveInstance

func (m *Manager) RemoveInstance(name string) error

RemoveInstance removes a service instance from the configuration

func (*Manager) RemoveProject

func (m *Manager) RemoveProject(name string) error

RemoveProject removes a project from the configuration

func (*Manager) Save

func (m *Manager) Save(config *types.Config) error

Save writes the configuration to disk

func (*Manager) SetDomain

func (m *Manager) SetDomain(domain string) error

SetDomain updates the domain preference

func (*Manager) SetProtocol

func (m *Manager) SetProtocol(protocol string) error

SetProtocol updates the protocol preference

func (*Manager) Update

func (m *Manager) Update(updateFn func(*types.Config) error) error

Update updates specific fields in the configuration

func (*Manager) UpdateCatalogVersion

func (m *Manager) UpdateCatalogVersion(version string) error

UpdateCatalogVersion updates the catalog version and timestamp

func (*Manager) UpdateInstance

func (m *Manager) UpdateInstance(name string, instance *types.Instance) error

UpdateInstance updates an existing instance

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

Jump to

Keyboard shortcuts

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