Revision 2a54b2dd

b/snf-pithos-app/pithos/api/services.py
1
# Copyright (C) 2013 GRNET S.A. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or
4
# without modification, are permitted provided that the following
5
# conditions are met:
6
#
7
#   1. Redistributions of source code must retain the above
8
#      copyright notice, this list of conditions and the following
9
#      disclaimer.
10
#
11
#   2. Redistributions in binary form must reproduce the above
12
#      copyright notice, this list of conditions and the following
13
#      disclaimer in the documentation and/or other materials
14
#      provided with the distribution.
15
#
16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
# POSSIBILITY OF SUCH DAMAGE.
28
#
29
# The views and conclusions contained in the software and
30
# documentation are those of the authors and should not be
31
# interpreted as representing official policies, either expressed
32
# or implied, of GRNET S.A.
33

  
34

  
35
pithos_services = {
36
    'pithos_object-store': {
37
        'type': 'object-store',
38
        'component': 'pithos',
39
        'prefix': 'object-store',
40
        'public': True,
41
        'endpoints': [
42
            {'version': 'v1',
43
             'publicURL': None},
44
        ]},
45

  
46
    'pithos_public': {
47
        'type': 'public',
48
        'component': 'pithos',
49
        'prefix': 'public',
50
        'public': True,
51
        'endpoints': [
52
            {'version': 'v2.0',
53
             'publicURL': None},
54
        ]},
55

  
56
    'pithos_ui': {
57
        'type': 'pithos_ui',
58
        'component': 'pithos',
59
        'prefix': 'ui',
60
        'public': True,
61
        'endpoints': [
62
            {'version': '',
63
             'publicURL': None},
64
        ]},
65
}
b/snf-pithos-app/pithos/api/settings.py
1 1
#coding=utf8
2 2
from django.conf import settings
3 3
from synnefo.lib import parse_base_url
4
from astakosclient import astakos_services
5
from synnefo.util.keypath import get_path
6
from pithos.api.services import pithos_services
4 7

  
5 8
# Top-level URL for Pithos. Must set.
6 9
BASE_URL = getattr(settings, 'PITHOS_BASE_URL',
7
                   "https://pithos.example.synnefo.org/")
10
                   "https://object-store.example.synnefo.org/pithos/")
8 11

  
9 12
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
10 13

  
14
# Process Astakos settings
11 15
ASTAKOS_BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
12
                           "https://accounts.example.synnefo.org/")
13

  
16
                           'https://accounts.example.synnefo.org/astakos/')
14 17
ASTAKOS_BASE_HOST, ASTAKOS_BASE_PATH = parse_base_url(ASTAKOS_BASE_URL)
15 18

  
19
PITHOS_PREFIX = get_path(pithos_services, 'pithos_object-store.prefix')
20
PUBLIC_PREFIX = get_path(pithos_services, 'pithos_public.prefix')
21
UI_PREFIX = get_path(pithos_services, 'pithos_ui.prefix')
22

  
23
CUSTOMIZE_ASTAKOS_SERVICES = \
24
        getattr(settings, 'PITHOS_CUSTOMIZE_ASTAKOS_SERVICES', ())
25
for path, value in CUSTOMIZE_ASTAKOS_SERVICES:
26
    set_path(astakos_services, path, value, createpath=True)
27

  
28
ASTAKOS_ACCOUNT_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
29

  
16 30
BASE_ASTAKOS_PROXY_PATH = getattr(settings, 'PITHOS_BASE_ASTAKOS_PROXY_PATH',
17 31
                                  ASTAKOS_BASE_PATH)
18 32

  
19
ASTAKOS_ACCOUNTS_PREFIX = getattr(settings, 'ASTAKOS_ACCOUNTS_PREFIX',
20
                                  'accounts')
21 33

  
22 34
ASTAKOSCLIENT_POOLSIZE = getattr(settings, 'PITHOS_ASTAKOSCLIENT_POOLSIZE', 200)
23 35

  
b/snf-pithos-app/pithos/api/urls.py
37 37
from snf_django.lib.api.utils import prefix_pattern
38 38
from pithos.api.settings import (
39 39
    BASE_PATH, ASTAKOS_BASE_URL, BASE_ASTAKOS_PROXY_PATH,
40
    ASTAKOS_ACCOUNTS_PREFIX, PROXY_USER_SERVICES)
40
    ASTAKOS_ACCOUNT_PREFIX, PROXY_USER_SERVICES,
41
    PITHOS_PREFIX, PUBLIC_PREFIX, UI_PREFIX)
41 42
from urlparse import urlparse
42 43

  
43 44

  
......
53 54

  
54 55
pithos_patterns = patterns(
55 56
    '',
56
    (r'^v1(?:$|/)', include(pithos_api_patterns)),
57
    (r'^v1\.0(?:$|/)', include(pithos_api_patterns)),
58
    (r'^public/(?P<v_public>.+?)/?$', 'pithos.api.public.public_demux'))
57
    (r'{0}v1/'.format(prefix_pattern(PITHOS_PREFIX)),
58
        include(pithos_api_patterns)),
59
    (r'{0}(?P<v_public>.+?)/?$'.format(prefix_pattern(PUBLIC_PREFIX)),
60
        'pithos.api.public.public_demux'))
59 61

  
60 62
urlpatterns = patterns(
61 63
    '',
......
71 73
        (r'^login/?$', astakos_proxy),
72 74
        (r'^feedback/?$', astakos_proxy),
73 75
        (r'^user_catalogs/?$', astakos_proxy),
74
        (prefix_pattern(ASTAKOS_ACCOUNTS_PREFIX), astakos_proxy),
76
        (prefix_pattern(ASTAKOS_ACCOUNT_PREFIX), astakos_proxy),
75 77
    )
76 78

  
77 79
    urlpatterns += patterns(

Also available in: Unified diff