Merge branch 'grafana_cloud_notifications' of github.com:grafana/oncall into grafana_cloud_notifications
This commit is contained in:
commit
13a2d39951
4 changed files with 12 additions and 2 deletions
|
|
@ -49,6 +49,7 @@ class FeaturesAPIView(APIView):
|
|||
enabled_features.append(MOBILE_APP_PUSH_NOTIFICATIONS)
|
||||
|
||||
if settings.OSS:
|
||||
# Features below should be enabled only in OSS
|
||||
enabled_features.append(FEATURE_GRAFANA_CLOUD_CONNECTION)
|
||||
if settings.FEATURE_LIVE_SETTINGS_ENABLED:
|
||||
enabled_features.append(FEATURE_LIVE_SETTINGS)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
from .info_throttler import InfoThrottler # noqa: F401
|
||||
from .phone_notification_throttler import PhoneNotificationThrottler # noqa: F401
|
||||
from .user_throttle import UserThrottle # noqa: F401
|
||||
6
engine/apps/public_api/throttlers/info_throttler.py
Normal file
6
engine/apps/public_api/throttlers/info_throttler.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from rest_framework.throttling import UserRateThrottle
|
||||
|
||||
|
||||
class InfoThrottler(UserRateThrottle):
|
||||
scope = "info"
|
||||
rate = "100/m"
|
||||
|
|
@ -3,14 +3,14 @@ from rest_framework.response import Response
|
|||
from rest_framework.views import APIView
|
||||
|
||||
from apps.auth_token.auth import ApiTokenAuthentication
|
||||
from apps.public_api.throttlers.user_throttle import UserThrottle
|
||||
from apps.public_api.throttlers import InfoThrottler
|
||||
|
||||
|
||||
class InfoView(APIView):
|
||||
authentication_classes = (ApiTokenAuthentication,)
|
||||
permission_classes = (IsAuthenticated,)
|
||||
|
||||
throttle_classes = [UserThrottle]
|
||||
throttle_classes = [InfoThrottler]
|
||||
|
||||
def get(self, request):
|
||||
response = {"url": self.request.auth.organization.grafana_url}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue