config

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HostsBeginMarker = fmt.Sprintf("### BEGIN_%s_HOSTS", strings.ToUpper(common.ProgramName))

Markers that indicate the beginning and end of the custom hosts section.

View Source
var HostsEndMarker = fmt.Sprintf("\n### END_%s_HOSTS", strings.ToUpper(common.ProgramName))

Functions

func GetDefaultConfigDirPath added in v0.9.0

func GetDefaultConfigDirPath() (string, error)

Returns the path to the configuration directory.

Types

type Config added in v0.4.0

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

Config contains all configuration options for the application.

func New added in v0.4.0

func New() (*Config, error)

Create a new Config instance with the default configuration.

func NewTesting added in v0.4.0

func NewTesting(testingConfigDir string) *Config

Create a new Config instance with the given configuration directory. Used for testing purposes.

func (*Config) AddDomain added in v0.7.0

func (c *Config) AddDomain(domain string) error

Add a domain to the custom hosts section.

func (*Config) AddNginxConfig added in v0.4.0

func (c *Config) AddNginxConfig(name string, domain string, port int64) error

Add a new Nginx configuration file with the given name, domain and port.

func (*Config) GetConfigDir added in v0.4.0

func (c *Config) GetConfigDir() string

Returns the path to the configuration directory.

func (*Config) GetDatabasePath added in v0.9.0

func (c *Config) GetDatabasePath() string

Returns the path of the sqlite3 database file.

func (*Config) GetHostsBackupDir added in v0.4.0

func (c *Config) GetHostsBackupDir() string

Returns the path to the hosts backup directory.

func (*Config) GetHostsFile added in v0.4.0

func (c *Config) GetHostsFile() string

Returns the path to the hosts file.

func (*Config) GetNginxConfigDir added in v0.4.0

func (c *Config) GetNginxConfigDir() string

Returns the path to the nginx configuration directory.

func (*Config) InitHosts added in v0.4.0

func (c *Config) InitHosts() error

Initialize the custom hosts section in the hosts file so domains can be added without overwriting the other contents of the file.

func (*Config) InitNginx added in v0.4.0

func (c *Config) InitNginx() error

Initialize the Nginx configuration directory.

func (*Config) IsTesting added in v0.4.0

func (c *Config) IsTesting() bool

Returns whether the application is in testing mode.

func (*Config) NginxAddDomainAlias added in v0.7.0

func (c *Config) NginxAddDomainAlias(name string, domainAlias string) error

Add a domain alias to a Nginx configuration file.

func (*Config) NginxRemoveDomainAlias added in v0.7.0

func (c *Config) NginxRemoveDomainAlias(name string, domainAlias string) error

Remove a domain alias from a Nginx configuration file.

func (*Config) RemoveDomain added in v0.7.0

func (c *Config) RemoveDomain(domain string) error

Remove a domain from the custom hosts section.

func (*Config) RemoveNginxConfig added in v0.4.0

func (c *Config) RemoveNginxConfig(name string) error

Remove a Nginx configuration file with the given name.

func (*Config) RenameNginxConfig added in v0.6.0

func (c *Config) RenameNginxConfig(oldName string, newName string) error

Rename a Nginx configuration file with the given old and new name.

func (*Config) UpdateHost added in v0.6.0

func (c *Config) UpdateHost(oldDomain string, newDomain string) error

Update a domain in the custom hosts section.

func (*Config) UpdateNginxConfig added in v0.6.0

func (c *Config) UpdateNginxConfig(name string, domain string, port int64) error

Update a Nginx configuration file with the given name, domain and port.

Jump to

Keyboard shortcuts

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