Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-webclient / pithos_webclient / settings.py @ ae9e1923

History | View | Annotate | Download (3.5 kB)

1
# Copyright 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
import pithos.api.settings as pithos_settings
35

    
36
from pithos.api.settings import LazyAstakosUrl
37
from django.conf import settings
38
from synnefo.lib import join_urls, parse_base_url
39
from synnefo.util.keypath import get_path
40
from pithos.api.services import pithos_services as vanilla_pithos_services
41
from synnefo.lib.services import get_public_endpoint, fill_endpoints
42

    
43
from copy import deepcopy
44

    
45
# --------------------------------------------------------------------
46
# Process Pithos settings
47

    
48
# This code is shared between snf-pithos-app and snf-pithos-webclient since
49
# they share the PITHOS_ settings prefix for most of their settings.
50
BASE_URL = getattr(settings, 'PITHOS_BASE_URL',
51
                   "https://object-store.example.synnefo.org/pithos/")
52

    
53
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
54

    
55
pithos_services = deepcopy(vanilla_pithos_services)
56
fill_endpoints(pithos_services, BASE_URL)
57
PITHOS_PREFIX = get_path(pithos_services, 'pithos_object-store.prefix')
58
PUBLIC_PREFIX = get_path(pithos_services, 'pithos_public.prefix')
59
UI_PREFIX = get_path(pithos_services, 'pithos_ui.prefix')
60

    
61
if not BASE_PATH.startswith("/"):
62
    BASE_PATH = "/" + BASE_PATH
63

    
64
PITHOS_URL = get_public_endpoint(pithos_services, 'object-store', 'v1')
65
PITHOS_UI_URL = get_public_endpoint(pithos_services, 'pithos_ui', '')
66

    
67
AUTH_COOKIE_NAME = getattr(settings, 'PITHOS_UI_AUTH_COOKIE_NAME',
68
                           '_pithos2_a')
69

    
70
CLOUDBAR_ACTIVE_SERVICE = getattr(
71
    settings,
72
    'PITHOS_UI_CLOUDBAR_ACTIVE_SERVICE',
73
    'pithos')
74

    
75

    
76
# --------------------------------------------------------------------
77
# Process Astakos settings
78

    
79
ASTAKOS_ACCOUNT_PROXY_PATH = join_urls(
80
    '/', pithos_settings.ASTAKOS_ACCOUNT_PROXY_PATH)
81
ASTAKOS_UI_PROXY_PATH = join_urls(
82
    '/', pithos_settings.ASTAKOS_UI_PROXY_PATH)
83

    
84
USER_CATALOG_URL = join_urls(ASTAKOS_ACCOUNT_PROXY_PATH, 'user_catalogs')
85
FEEDBACK_URL = join_urls(ASTAKOS_ACCOUNT_PROXY_PATH, 'feedback')
86
LOGIN_URL = join_urls(str(LazyAstakosUrl('ui_url')), 'login?next=')