NginxModule(self, /, *args, **kwargs)
Enum of the valid NGINX modules.
Valid options are:
NginxModule.HTTP
NginxModule.STREAM
NginxConfigError(self, /, *args, **kwargs)
Exception to raise for errors in this module.
NginxBase(self)
NGINX base class.
CAUTION You can only use this class after the 'nginx-config.installed' flag is set !
Path to the backup directory.
Path to the Http module include directory.
Name of the juju application with unit number.
Path to the Stream module include directory.
NginxBase.validate_nginx(self)
Validates the NGINX configuration. Raises NginxConfigError when invalid.
Raises
NginxConfigError
NginxBase.reload_nginx(self)
Reloads NGINX configuration. Raises NginxConfigError on error.
Raises
NginxConfigError
NginxMainConfig(self)
Represents the nginx.conf file.
The nginx.conf file as a nginx.Conf object.
NginxMainConfig.config_as_dict(self)
Returns the NGINX main config file as a dict.
NginxMainConfig.config_as_object(self)
Returns the NGINX main config file as a nginx.Conf object.
NginxMainConfig.add_include(self, include, nginx_module)
Adds an include value to the module.
Parameters
include
(str): Include string.nginx_module
(NginxModule): NGINX module.
NginxMainConfig.get_includes(self, nginx_module)
Return all includes values from a NGINX module.
Parameters
nginx_module
(NginxModule): NGINX module.
Returns
list
: A list containing all found include values.
NginxMainConfig.add_module(self, nginx_module)
Add a Http or Stream module to the NGINX config. If the module already exists, do nothing.
Parameters
nginx_module
(NginxModule): NGINX module.
Raises
NginxConfigError
NginxMainConfig.load_module(self, nginx_cfg, nginx_module)
Return a module from the main NGINX config file.
Parameters
nginx_cfg
(nginx.Conf): NGINX objectnginx_module
(NginxModule): NGINX module.
Returns
nginx.Http or nginx.Stream
Raises
NginxConfigError
NginxMainConfig.write_nginx_config(self)
Writes the _nginx_config object to the nginx.conf file.
NginxMainConfig.backup_nginx_config(self, dst=None)
Creates a copy of the nginx.conf file to the destination. Default to _backup_path if no destination is specified.
Parameters
dst
(str or None): Destination path.
Raises
NginxConfigError
NginxConfig(self)
Class for modifying NGINX configs.
Path to the layer directory.
Path to the sites-available directory.
Name of the layer creating the class.
Path to the streams-available directory.
NginxConfig.write_config(self, nginx_module, config, filename, subdir=None)
Writes the config to the nginx_module available dir.
Parameters
nginx_module
(NginxModule): NGINX module.config
(str): NGINX config to be written.filename
(str): Name of the config file.subdir
(str or None): If specified, the value of subdir will be appended to the available_path variable. Use this if you want to write the config to a self made directory.
Raises
NginxConfigError
NginxConfig.enable_all_config(self, nginx_module, subdir=None)
Creates symb links in the nginx_module enabled dir for all files in the available directory.
Parameters
nginx_module
(NginxModule): NGINX module.subdir
(str or None): If specified, the value of subdir will be appended to the available_path variable. Use this if you wrote configs to a seperate directory.
Raises
NginxConfigError
NginxConfig.delete_all_config(self, nginx_module, subdir=None)
Delete all symb links and configs from the nginx_module.
Parameters
nginx_module
(NginxModule): NGINX module.subdir
(str or None): If specified, the value of subdir will be appended to the available_path variable. Use this if you don't want to delete all configs in the available directory but instead a self made subdir.
Raises
NginxConfigError