root / snf-pithos-webclient / pithos_webclient / settings.py @ 0afd9936
History | View | Annotate | Download (3.4 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 pithos.api.services import pithos_services as vanilla_pithos_services |
40 |
from synnefo.lib.services import get_public_endpoint, fill_endpoints |
41 |
|
42 |
from copy import deepcopy |
43 |
|
44 |
# --------------------------------------------------------------------
|
45 |
# Process Pithos settings
|
46 |
|
47 |
# This code is shared between snf-pithos-app and snf-pithos-webclient since
|
48 |
# they share the PITHOS_ settings prefix for most of their settings.
|
49 |
BASE_URL = getattr(settings, 'PITHOS_BASE_URL', |
50 |
"https://object-store.example.synnefo.org/pithos/")
|
51 |
|
52 |
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL) |
53 |
|
54 |
pithos_services = deepcopy(vanilla_pithos_services) |
55 |
fill_endpoints(pithos_services, BASE_URL) |
56 |
PITHOS_PREFIX = pithos_services['pithos_object-store']['prefix'] |
57 |
PUBLIC_PREFIX = pithos_services['pithos_public']['prefix'] |
58 |
UI_PREFIX = pithos_services['pithos_ui']['prefix'] |
59 |
|
60 |
if not BASE_PATH.startswith("/"): |
61 |
BASE_PATH = "/" + BASE_PATH
|
62 |
|
63 |
PITHOS_URL = get_public_endpoint(pithos_services, 'object-store', 'v1') |
64 |
PITHOS_UI_URL = get_public_endpoint(pithos_services, 'pithos_ui', '') |
65 |
|
66 |
AUTH_COOKIE_NAME = getattr(settings, 'PITHOS_UI_AUTH_COOKIE_NAME', |
67 |
'_pithos2_a')
|
68 |
|
69 |
CLOUDBAR_ACTIVE_SERVICE = getattr(
|
70 |
settings, |
71 |
'PITHOS_UI_CLOUDBAR_ACTIVE_SERVICE',
|
72 |
'pithos')
|
73 |
|
74 |
|
75 |
# --------------------------------------------------------------------
|
76 |
# Process Astakos settings
|
77 |
|
78 |
ASTAKOS_ACCOUNT_PROXY_PATH = join_urls( |
79 |
'/', pithos_settings.ASTAKOS_ACCOUNT_PROXY_PATH)
|
80 |
ASTAKOS_UI_PROXY_PATH = join_urls( |
81 |
'/', pithos_settings.ASTAKOS_UI_PROXY_PATH)
|
82 |
|
83 |
USER_CATALOG_URL = join_urls(ASTAKOS_ACCOUNT_PROXY_PATH, 'user_catalogs')
|
84 |
FEEDBACK_URL = join_urls(ASTAKOS_ACCOUNT_PROXY_PATH, 'feedback')
|
85 |
LOGIN_URL = join_urls(ASTAKOS_UI_PROXY_PATH, 'login?next=')
|