def httpsRedirect(self,ee_domain_name,redirect=True):
    if redirect:
        if os.path.isfile("/etc/nginx/conf.d/force-ssl-{0}.conf.disabled".format(ee_domain_name)):
                EEFileUtils.mvfile(self, "/etc/nginx/conf.d/force-ssl-{0}.conf.disabled".format(ee_domain_name),
                                  "/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name))
        else:
            try:
                Log.info(self, "Adding /etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name))

                sslconf = open("/etc/nginx/conf.d/force-ssl-{0}.conf"
                                      .format(ee_domain_name),
                                      encoding='utf-8', mode='w')
                sslconf.write("server {\n"
                                     "\tlisten 80;\n" +
                                     "\tserver_name www.{0} {0};\n".format(ee_domain_name) +
                                     "\treturn 301 https://{0}".format(ee_domain_name)+"$request_uri;\n}" )
                sslconf.close()
                # Nginx Configation into GIT
            except __HOLE__ as e:
                Log.debug(self, str(e))
                Log.debug(self, "Error occured while generating "
                              "/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name))

        Log.info(self, "Added HTTPS Force Redirection for Site "
                         " http://{0}".format(ee_domain_name))
        EEGit.add(self,
                  ["/etc/nginx"], msg="Adding /etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name))
    else:
        if os.path.isfile("/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name)):
             EEFileUtils.mvfile(self, "/etc/nginx/conf.d/force-ssl-{0}.conf".format(ee_domain_name),
                                  "/etc/nginx/conf.d/force-ssl-{0}.conf.disabled".format(ee_domain_name))
             Log.info(self, "Disabled HTTPS Force Redirection for Site "
                         " http://{0}".format(ee_domain_name))
dataset/ETHPy150Open EasyEngine/easyengine/ee/cli/plugins/site_functions.py/httpsRedirect