mik-laj commented on a change in pull request #9497:
URL: https://github.com/apache/airflow/pull/9497#discussion_r444846952



##########
File path: airflow/api_connexion/endpoints/config_endpoint.py
##########
@@ -15,12 +15,41 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# TODO(mik-laj): We have to implement it.
-#     Do you want to help? Please look at: 
https://github.com/apache/airflow/issues/8136
+from flask import Response, request
 
+from airflow.api_connexion.schemas.config_schema import config_schema
+from airflow.configuration import conf
 
-def get_config():
+
+def get_config() -> Response:
     """
     Get current configuration.
     """
-    raise NotImplementedError("Not implemented yet.")
+    response_types = ['text/plain', 'application/json']
+    content_type = request.accept_mimetypes.best_match(response_types)
+    conf_dict = conf.as_dict(display_source=True, display_sensitive=True)
+    if content_type == 'text/plain':
+        config = ''
+        for section, parameters in conf_dict.items():
+            config += f'[{section}]\n'
+            for key, (value, source) in parameters.items():
+                config += f'{key} = {value}  # source: {source}\n'
+    else:
+        config = {
+            'sections': [

Review comment:
       Can you use NamedTuple here?




----------------------------------------------------------------
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:
[email protected]


Reply via email to