Commits

Denis Darii committed 30f99a4

added nginx_https parameter

  • Participants
  • Parent commits 728b51f

Comments (0)

Files changed (2)

File fagungis/example_fabfile.py

     env.nginx_conf_file = '%(django_user_home)s/configs/nginx/%(project)s.conf' % env
     env.nginx_client_max_body_size = 10  # Maximum accepted body size of client request, in MB
     env.nginx_htdocs = '%(django_user_home)s/htdocs' % env
+    # will configure nginx with ssl on, your certificate must be installed
+    # more info here: http://wiki.nginx.org/HttpSslModule
+    env.nginx_https = False
     ### END nginx settings ###
 
     ### START supervisor settings ###

File fagungis/tasks.py

         errors.append('"nginx_htdocs" configuration missing')
     elif verbose:
         parameters_info.append(('nginx_htdocs', env.nginx_htdocs))
+
+    if 'nginx_https' not in env:
+        env.nginx_https = False
+    elif not isinstance(env.nginx_https, bool):
+        errors.append('"nginx_https" must be a boolean value')
+    elif verbose:
+        parameters_info.append(('nginx_https', env.nginx_https))
+
     if 'supervisor_program_name' not in env or not env.supervisor_program_name:
         env.supervisor_program_name = env.project
     if verbose:
 
 def _upload_nginx_conf():
     ''' upload nginx conf '''
-    if isfile('conf/nginx.conf'):
-        ''' we use user defined nginx.conf template '''
-        template = 'conf/nginx.conf'
+    local_nginx_conf_file = 'nginx.conf'
+    if env.nginx_https:
+        local_nginx_conf_file = 'nginx_https.conf'
+    if isfile('conf/%s' % local_nginx_conf_file):
+        ''' we use user defined conf template '''
+        template = 'conf/%s' % local_nginx_conf_file
     else:
-        template = '%s/conf/nginx.conf' % fagungis_path
+        template = '%s/conf/%s' % (fagungis_path, local_nginx_conf_file)
     context = copy(env)
     # Template
     upload_template(template, env.nginx_conf_file,