Documentation ¶
Index ¶
- func GetAugPath(fullPath string) string
- type ApacheConfigurator
- type Parser
- func (p *Parser) AddDirective(augConfPath string, directive string, args []string) error
- func (p *Parser) AddDirectiveToIfModSSL(augConfPath string, directive string, args []string) error
- func (p *Parser) AddInclude(mainConfigPath string, inclPath string) error
- func (p *Parser) AddModule(name string)
- func (p *Parser) Close()
- func (p *Parser) CreateIfModule(augConfPath string, mod string, begining bool) (string, error)
- func (p *Parser) ExcludeDirectives(matches []string) ([]string, error)
- func (p *Parser) FindDirective(directive, arg, start string, exclude bool) ([]string, error)
- func (p *Parser) GetArg(match string) (string, error)
- func (p *Parser) GetAugeasError(errorsToExclude []string) error
- func (p *Parser) GetIfModule(augConfPath string, mod string, begining bool) (string, error)
- func (p *Parser) GetRootAugPath() (string, error)
- func (p *Parser) GetUnsavedFiles() ([]string, error)
- func (p *Parser) IsFilenameExistInCurrentPaths(filename string) bool
- func (p *Parser) IsFilenameExistInOriginalPaths(filename string) bool
- func (p *Parser) ParseFile(fPath string) error
- func (p *Parser) ResetModules() error
- func (p *Parser) Save(reverter *Reverter) error
- func (p *Parser) SetBeforeDomReloadCallback(callback func(unsavedFiles []string))
- func (p *Parser) UpdateDefines() error
- func (p *Parser) UpdateIncludes() error
- func (p *Parser) UpdateModules() error
- func (p *Parser) UpdateRuntimeVariables() error
- type Reverter
- func (r *Reverter) AddFileToDeletion(filePath string)
- func (r *Reverter) AddSiteConfigToDisable(siteConfigName string)
- func (r *Reverter) BackupFile(filePath string) error
- func (r *Reverter) BackupFiles(filePaths []string) error
- func (r *Reverter) Commit() error
- func (r *Reverter) Rollback() error
- func (r *Reverter) SetLogger(logger logger.Logger)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAugPath ¶
GetAugPath returns Augeas path for the file full path
Types ¶
type ApacheConfigurator ¶
type ApacheConfigurator interface { GetParser() *Parser GetVhosts() ([]*entity.VirtualHost, error) Save() error DeployCertificate(serverName, certPath, certKeyPath, chainPath, fullChainPath string) error EnableSite(vhost *entity.VirtualHost) error PrepareHTTPSModules(temp bool) error EnableModule(module string, temp bool) error EnsurePortIsListening(port string, https bool) error GetSuitableVhosts(serverName string, createIfNoSsl bool) ([]*entity.VirtualHost, error) FindSuitableVhosts(serverName string) ([]*entity.VirtualHost, error) CheckConfiguration() bool RestartWebServer() error SetLogger(logger logger.Logger) Commit() error Rollback() error }
ApacheConfigurator manipulates with apache configs
func GetApacheConfigurator ¶
func GetApacheConfigurator(options map[string]string) (ApacheConfigurator, error)
GetApacheConfigurator returns ApacheConfigurator instance
type Parser ¶
type Parser struct { Augeas augeas.Augeas ApacheCtl *apache.Ctl ServerRoot string VHostRoot string ConfigRoot string СonfigListen string Paths map[string][]string Modules map[string]bool // contains filtered or unexported fields }
Parser ia a wrapper under the augeas to work with httpd config
func (*Parser) AddDirective ¶
AddDirective adds directive to the end of the file given by augConfPath
func (*Parser) AddDirectiveToIfModSSL ¶
AddDirectiveToIfModSSL adds directive to the end of the file given by augConfPath within IfModule ssl block
func (*Parser) AddInclude ¶
AddInclude adds Include directive for a configuration file
func (*Parser) Close ¶
func (p *Parser) Close()
Close closes the Parser instance and frees any storage associated with it.
func (*Parser) CreateIfModule ¶
CreateIfModule creates a new <IfMod mod> and returns its path
func (*Parser) ExcludeDirectives ¶
ExcludeDirectives excludes directives that are not loaded into the configuration.
func (*Parser) FindDirective ¶
FindDirective finds directive in configuration directive - directive to look for arg - directive value. If empty string then all directives should be considrered start - Augeas path that should be used to begin looking for the directive exclude - whether or not to exclude directives based on variables and enabled modules
func (*Parser) GetAugeasError ¶
GetAugeasError return Augeas errors
func (*Parser) GetIfModule ¶
GetIfModule returns the path to <IfModule mod> and creates one if it does not exist
func (*Parser) GetRootAugPath ¶
GetRootAugPath returns Augeas path of the root configuration
func (*Parser) GetUnsavedFiles ¶
GetUnsavedFiles returns unsaved paths
func (*Parser) IsFilenameExistInCurrentPaths ¶
IsFilenameExistInCurrentPaths checks if the file path is parsed by current Augeas parser config
func (*Parser) IsFilenameExistInOriginalPaths ¶
IsFilenameExistInOriginalPaths checks if the file path is parsed by existing Apache config
func (*Parser) ResetModules ¶
ResetModules resets the loaded modules list
func (*Parser) SetBeforeDomReloadCallback ¶
SetBeforeDomReloadCallback sets callback that will be executed before augeas dom load/reload It can be used to makes sure that all Augeas dom changes are written to files to avoid loss of configuration directives when doing additional augeas parsing, causing a possible augeas.load() resulting dom reset
func (*Parser) UpdateDefines ¶
UpdateDefines Updates the map of known variables in the configuration
func (*Parser) UpdateIncludes ¶
UpdateIncludes gets includes from httpd process, and add them to DOM if needed
func (*Parser) UpdateModules ¶
UpdateModules gets loaded modules from httpd process, and add them to DOM
func (*Parser) UpdateRuntimeVariables ¶
UpdateRuntimeVariables Updates Includes, Defines and Includes from httpd config dump data
type Reverter ¶
type Reverter struct {
// contains filtered or unexported fields
}
Reverter reverts change back for configuration files of virtual hosts
func (*Reverter) AddFileToDeletion ¶
AddFileToDeletion marks file to delete on rollback
func (*Reverter) AddSiteConfigToDisable ¶
AddSiteConfigToDisable marks apache site config as needed to be disabled on rollback
func (*Reverter) BackupFile ¶
BackupFile makes file backup. The file content will be restored on rollback.
func (*Reverter) BackupFiles ¶
BackupFiles makes files backups