Commit 250d2375 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos: Configurable exclude api calls from being served

Prevent api calls from being served by setting PITHOS_SERVE_API
to False.
parent 9c7b324e
......@@ -62,3 +62,6 @@
# the views with astakos during the resource access token generation procedure
#OA2_CLIENT_CREDENTIALS = getattr(settings, 'PITHOS_OA2_CLIENT_CREDENTIALS',
# (None, None))
#
# Set to False to serve only views
#SERVE_API = getattr(settings, 'PITHOS_SERVE_API', True)
......@@ -183,7 +183,11 @@ BACKEND_BLOCK_SIZE = getattr(
# The backend block hash algorithm
BACKEND_HASH_ALGORITHM = getattr(
settings, 'PITHOS_BACKEND_HASH_ALGORITHM', 'sha256')
# Set the credentials (client_id, client_secret) issued to authenticate
# the views with astakos during the resource access token generation procedure
OA2_CLIENT_CREDENTIALS = getattr(settings, 'PITHOS_OA2_CLIENT_CREDENTIALS',
(None, None))
# Set to False to serve only views
SERVE_API = getattr(settings, 'PITHOS_SERVE_API', True)
......@@ -43,7 +43,7 @@ from pithos.api.settings import (
BASE_PATH, PITHOS_PREFIX, PUBLIC_PREFIX, VIEW_PREFIX,
ASTAKOS_AUTH_PROXY_PATH, ASTAKOS_AUTH_URL,
ASTAKOS_ACCOUNT_PROXY_PATH, ASTAKOS_ACCOUNT_URL,
ASTAKOS_UI_PROXY_PATH, ASTAKOS_UI_URL,
ASTAKOS_UI_PROXY_PATH, ASTAKOS_UI_URL, SERVE_API,
pithos_services)
......@@ -68,15 +68,19 @@ pithos_view_patterns = patterns(
(r'^(?P<v_account>.+?)/(?P<v_container>.+?)/(?P<v_object>.+?)$',
'object_read'))
pithos_patterns = patterns(
if SERVE_API:
pithos_patterns = patterns(
'',
(r'{0}v1/'.format(prefix_pattern(PITHOS_PREFIX)),
include(pithos_api_patterns)),
(r'{0}.*'.format(prefix_pattern(PITHOS_PREFIX)),
api_endpoint_not_found),
(r'{0}(?P<v_public>.+?)/?$'.format(prefix_pattern(PUBLIC_PREFIX)),
'pithos.api.public.public_demux'),
)
urlpatterns += patterns(
'',
(r'{0}v1/'.format(prefix_pattern(PITHOS_PREFIX)),
include(pithos_api_patterns)),
(r'{0}.*'.format(prefix_pattern(PITHOS_PREFIX)),
api_endpoint_not_found),
(r'{0}(?P<v_public>.+?)/?$'.format(prefix_pattern(PUBLIC_PREFIX)),
'pithos.api.public.public_demux'),
(r'{0}'.format(prefix_pattern(UI_PREFIX)),
(r'{0}'.format(prefix_pattern(VIEW_PREFIX)),
include(pithos_view_patterns)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment