From 28a01531d41726cda96e9bab182d14bffdfa22e0 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Sun, 1 Mar 2015 08:20:02 -0800 Subject: [PATCH] Adding an endpoint to get the raw config, will be used to automate setting up a sandbox --- README.md | 2 +- airflow/www/app.py | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d74426ab2b..776dba4e38 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/airflow/www/app.py b/airflow/www/app.py index 8192ea5233..1dd37e9581 100644 --- a/airflow/www/app.py +++ b/airflow/www/app.py @@ -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):