diff --git a/modules/initialize.py b/modules/initialize.py index 416871e..219ccc0 100644 --- a/modules/initialize.py +++ b/modules/initialize.py @@ -120,9 +120,9 @@ def add_template(dataobject, layout, config, section, template_name="conf"): # dataobject.templates.section.tname.src # dataobject.templates.section.tname.dst - if env.debug: - # logger = loggify('intialize', 'add_template') - debug_section = "DEBUG initialize.add_templates[%s]" % section + # if env.debug: + # # logger = loggify('intialize', 'add_template') + # debug_section = "DEBUG initialize.add_templates[%s]" % section if not hasattr(dataobject.templates, section): dataobject.templates.addbranch(section) @@ -143,25 +143,28 @@ def add_template(dataobject, layout, config, section, template_name="conf"): var_section_source = layout['templates'][section][template_name]['source'] var_section_output = layout['templates'][section][template_name]['output'] - if env.debug and section == 'nginx': - print("%s -- var_section_path: %s" % (debug_section, var_section_path)) - print("%s -- var_section_source: %s" % - (debug_section, var_section_source)) + # debug statements + # + # if env.debug and section == 'nginx': + # print("%s -- var_section_path: %s" % ( + # debug_section, var_section_path)) + # print("%s -- var_section_source: %s" % + # (debug_section, var_section_source)) - print("%s -- templates in config: %s" % - (debug_section, 'templates' in config)) + # print("%s -- templates in config: %s" % + # (debug_section, 'templates' in config)) - print("%s -- nginx in config: %s" % - (debug_section, 'nginx' in config)) + # print("%s -- nginx in config: %s" % + # (debug_section, 'nginx' in config)) - if 'nginx' in config: - print("%s -- ssl in config[nginx]: %s" % - (debug_section, 'ssl' in config['nginx'])) - print("%s -- port in config[nginx]: %s" % - (debug_section, 'port' in config['nginx'])) + # if 'nginx' in config: + # print("%s -- ssl in config[nginx]: %s" % + # (debug_section, 'ssl' in config['nginx'])) + # print("%s -- port in config[nginx]: %s" % + # (debug_section, 'port' in config['nginx'])) - if 'templates' in config: - print("%s -- templates in config" % debug_section) + # if 'templates' in config: + # print("%s -- templates in config" % debug_section) if 'templates' in config and section in config['templates']: _config = config['templates'][section] @@ -169,8 +172,10 @@ def add_template(dataobject, layout, config, section, template_name="conf"): var_section_source = _config[template_name]['source'] var_section_output = _config[template_name]['output'] - if env.debug: - print("%s -- breakpoint 2" % debug_section) + # debug statements + # + # if env.debug: + # print("%s -- breakpoint 2" % debug_section) # define the local, and dest paths _template.path.local = os.path.join( @@ -189,12 +194,14 @@ def add_template(dataobject, layout, config, section, template_name="conf"): conf_template.src = var_section_source conf_template.dst = var_section_output - if env.debug: - print("%s -- template_name: %s" % (debug_section, template_name)) - print("%s -- conf_template.src: %s" % - (debug_section, conf_template.src)) - print("%s -- conf_template.dst: %s" % - (debug_section, conf_template.dst)) + # debug statements + # + # if env.debug: + # print("%s -- template_name: %s" % (debug_section, template_name)) + # print("%s -- conf_template.src: %s" % + # (debug_section, conf_template.src)) + # print("%s -- conf_template.dst: %s" % + # (debug_section, conf_template.dst)) def get_config(branchname): @@ -393,20 +400,26 @@ def get_config(branchname): dataobject.server.nginx.port = config['nginx']['port'] dataobject.server.nginx.socket = config['nginx']['socket'] - - if 'ssl' in config['nginx']: - - dataobject.server.nginx.addbranch('ssl') - - dataobject.server.nginx.ssl.servername = \ - config['nginx']['ssl_server_name'] - - dataobject.server.nginx.ssl.serverext = \ - config['nginx']['ssl_server_ext'] - print("DEBUG -- socket: %s" % dataobject.server.nginx.socket) - if config['project']['host'] == "localhost": + if 'host' in config['nginx']: + + # if we specificed a host name in the + # configuration file under 'nginx' + + # dataobject.server.nginx.addbranch('ssl') + + # dataobject.server.nginx.ssl.host = \ + # config['nginx']['ssl']['host'] + + dataobject.server.nginx.host = \ + config['nginx']['host'] + + elif config['project']['host'] == "localhost": + + # if localhost, then create a nginx appropriate name based on + # the project name and the extension + dataobject.server.nginx.host = "{projectname}.{ext}".format( ext=dataobject.project.extension, projectname=dataobject.project.name) diff --git a/modules/nginx.py b/modules/nginx.py index 7a0cbbd..6cd72cd 100644 --- a/modules/nginx.py +++ b/modules/nginx.py @@ -91,6 +91,10 @@ def edit(param='help'): 'path': configuration.logging.nginx.access, 'desc': "nginx access log file", }, + 'log.nginx.error': { + 'path': '/var/log/nginx/error.log', + 'desc': "nginx main error file" + }, } if param in locations.keys():