superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccwilli...@apache.org
Subject [incubator-superset] branch master updated: [api] add `available_domains/` endpoint (#7097)
Date Sat, 23 Mar 2019 00:51:35 GMT
This is an automated email from the ASF dual-hosted git repository.

ccwilliams pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 7457a35  [api] add `available_domains/` endpoint (#7097)
7457a35 is described below

commit 7457a35b125e0396f0b06cca3ffb82b25e03bef9
Author: Chris Williams <williaster@users.noreply.github.com>
AuthorDate: Fri Mar 22 17:51:28 2019 -0700

    [api] add `available_domains/` endpoint (#7097)
    
    * [api] add available_domains/ endpoint
    
    * [available_domains] no trailing whitespaces
---
 superset/views/core.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index 051ea56..cd73cb4 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -44,7 +44,7 @@ from werkzeug.routing import BaseConverter
 from werkzeug.utils import secure_filename
 
 from superset import (
-    app, appbuilder, cache, db, results_backend,
+    app, appbuilder, cache, conf, db, results_backend,
     security_manager, sql_lab, viz)
 from superset.connectors.connector_registry import ConnectorRegistry
 from superset.connectors.sqla.models import AnnotationDatasource, SqlaTable
@@ -1882,6 +1882,20 @@ class Superset(BaseSupersetView):
 
     @api
     @has_access_api
+    @expose('/available_domains/', methods=['GET'])
+    def available_domains(self):
+        """
+        Returns the list of available Superset Webserver domains (if any)
+        defined in config. This enables charts embedded in other apps to
+        leverage domain sharding if appropriately configured.
+        """
+        return Response(
+            json.dumps(conf.get('SUPERSET_WEBSERVER_DOMAINS')),
+            mimetype='text/json',
+        )
+
+    @api
+    @has_access_api
     @expose('/fave_dashboards_by_username/<username>/', methods=['GET'])
     def fave_dashboards_by_username(self, username):
         """This lets us use a user's username to pull favourite dashboards"""


Mime
View raw message