diff --git a/letsencrypt_gandi/shs.py b/letsencrypt_gandi/shs.py index 5a4e455..53d5dd9 100644 --- a/letsencrypt_gandi/shs.py +++ b/letsencrypt_gandi/shs.py @@ -69,6 +69,8 @@ def add_parser_arguments(cls, add): help="shs name.") add("vhost", default='default', help="vhost") + add("htdocs", + help="custom htdocs folder (only for PHP instances)") def __init__(self, *args, **kwargs): """Initialize an SHS Configurator. @@ -126,6 +128,7 @@ def prepare(self): "name".format(self.option_name('name'))) self.vhost = self.conf('vhost') + self.htdocs = self.conf('htdocs') def _api_key_from_gandi_cli(self): """Got cli? grab it https://cli.gandi.net @@ -191,7 +194,9 @@ def _lookup_shs(self): return paas['user'], paas['ftp_server'] def _base_path(self): - if re.match('^php', self.shs_info['type']): + if self.htdocs and re.match('^php', self.shs_info['type']): + return 'vhosts/{vhost}/{htdocs}/'.format(vhost=self.vhost, htdocs=self.htdocs) + elif re.match('^php', self.shs_info['type']): return 'vhosts/{vhost}/htdocs/'.format(vhost=self.vhost) elif re.match('^(python|nodejs)', self.shs_info['type']): return 'vhosts/default'