You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/03/06 18:54:11 UTC

[GitHub] [airflow] ashb commented on a change in pull request #14641: Remove the default config from the Configuration View, show only running configuration

ashb commented on a change in pull request #14641:
URL: https://github.com/apache/airflow/pull/14641#discussion_r588917174



##########
File path: airflow/www/views.py
##########
@@ -2653,42 +2653,39 @@ class ConfigurationView(AirflowBaseView):
     )
     def conf(self):
         """Shows configuration."""
-        raw = request.args.get('raw') == "true"
         title = "Airflow Configuration"
-        subtitle = AIRFLOW_CONFIG
-        # Don't show config when expose_config variable is False in airflow config
+
         if conf.getboolean("webserver", "expose_config"):
-            with open(AIRFLOW_CONFIG) as file:
-                config = file.read()
             table = [
                 (section, key, value, source)
                 for section, parameters in conf.as_dict(True, True).items()
                 for key, (value, source) in parameters.items()
             ]
-        else:
-            config = (
-                "# Your Airflow administrator chose not to expose the "
-                "configuration, most likely for security reasons."
+
+            if request.args.get('raw') == "true":
+                return Response(response=json.dumps(table), status=200, mimetype="application/json")

Review comment:
       If we're going to return json we should just content negotiation (i.e. Accept headers)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org