blanketed out annoying debug statements, added code to allow for a custom nginx host name
This commit is contained in:
parent
0f94909568
commit
0d68ef122d
2 changed files with 55 additions and 38 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue