Adding an endpoint to get the raw config, will be used to automate setting up a sandbox

This commit is contained in:
Maxime Beauchemin 2015-03-01 08:20:02 -08:00
Родитель ed207f04c0
Коммит 28a01531d4
2 изменённых файлов: 18 добавлений и 10 удалений

Просмотреть файл

@ -2,4 +2,4 @@ Airflow
====
Airflow is a system to programmaticaly author, schedule and monitor data pipelines.
[Documentation](http://airflow.readthedocs.org/en/latest/)
[Documentation](http://pythonhosted.org/airflow/)

Просмотреть файл

@ -554,20 +554,28 @@ class Airflow(BaseView):
@login_required
def conf(self):
from airflow import configuration
raw = request.args.get('raw') == "true"
title = "Airflow Configuration"
subtitle = configuration.AIRFLOW_CONFIG
f = open(configuration.AIRFLOW_CONFIG, 'r')
config = f.read()
code_html = Markup(highlight(
f.read(),
IniLexer(), # Lexer call
HtmlFormatter(noclasses=True))
)
f.close()
return self.render(
'airflow/code.html',
pre_subtitle=settings.HEADER + " v" + airflow.__version__,
code_html=code_html, title=title, subtitle=subtitle)
if raw:
return Response(
response=config,
status=200,
mimetype="application/text")
else:
code_html = Markup(highlight(
config,
IniLexer(), # Lexer call
HtmlFormatter(noclasses=True))
)
return self.render(
'airflow/code.html',
pre_subtitle=settings.HEADER + " v" + airflow.__version__,
code_html=code_html, title=title, subtitle=subtitle)
@expose('/noaccess')
def noaccess(self):