Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-app / pithos / api / settings.py @ 5ec446aa

History | View | Annotate | Download (4.8 kB)

1
#coding=utf8
2
from django.conf import settings
3
from synnefo.lib import parse_base_url, join_urls
4
from synnefo.lib.services import fill_endpoints
5
from synnefo.util.keypath import get_path, set_path
6
from pithos.api.services import pithos_services as vanilla_pithos_services
7
from astakosclient import astakos_services as vanilla_astakos_services
8

    
9
from copy import deepcopy
10

    
11
# Top-level URL for Pithos. Must set.
12
BASE_URL = getattr(settings, 'PITHOS_BASE_URL',
13
                   "https://object-store.example.synnefo.org/pithos/")
14

    
15
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
16

    
17
# Process Astakos settings
18
ASTAKOS_BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
19
                           'https://accounts.example.synnefo.org/astakos/')
20
ASTAKOS_BASE_HOST, ASTAKOS_BASE_PATH = parse_base_url(ASTAKOS_BASE_URL)
21

    
22
pithos_services = deepcopy(vanilla_pithos_services)
23
fill_endpoints(pithos_services, BASE_URL)
24
PITHOS_PREFIX = get_path(pithos_services, 'pithos_object-store.prefix')
25
PUBLIC_PREFIX = get_path(pithos_services, 'pithos_public.prefix')
26
UI_PREFIX = get_path(pithos_services, 'pithos_ui.prefix')
27

    
28
astakos_services = deepcopy(vanilla_astakos_services)
29
fill_endpoints(astakos_services, ASTAKOS_BASE_URL)
30
CUSTOMIZE_ASTAKOS_SERVICES = \
31
        getattr(settings, 'PITHOS_CUSTOMIZE_ASTAKOS_SERVICES', ())
32
for path, value in CUSTOMIZE_ASTAKOS_SERVICES:
33
    set_path(astakos_services, path, value, createpath=True)
34

    
35
ASTAKOS_ACCOUNTS_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
36
ASTAKOS_VIEWS_PREFIX = get_path(astakos_services, 'astakos_ui.prefix')
37
ASTAKOS_KEYSTONE_PREFIX = get_path(astakos_services, 'astakos_identity.prefix')
38

    
39
BASE_ASTAKOS_PROXY_PATH = getattr(settings, 'PITHOS_BASE_ASTAKOS_PROXY_PATH',
40
                                  ASTAKOS_BASE_PATH)
41
BASE_ASTAKOS_PROXY_PATH = join_urls(BASE_PATH, BASE_ASTAKOS_PROXY_PATH)
42
BASE_ASTAKOS_PROXY_PATH = BASE_ASTAKOS_PROXY_PATH.strip('/')
43

    
44

    
45
ASTAKOSCLIENT_POOLSIZE = getattr(settings, 'PITHOS_ASTAKOSCLIENT_POOLSIZE', 200)
46

    
47
COOKIE_NAME = getattr(settings, 'PITHOS_ASTAKOS_COOKIE_NAME', '_pithos2_a')
48

    
49
# SQLAlchemy (choose SQLite/MySQL/PostgreSQL).
50
BACKEND_DB_MODULE = getattr(
51
    settings, 'PITHOS_BACKEND_DB_MODULE', 'pithos.backends.lib.sqlalchemy')
52
BACKEND_DB_CONNECTION = getattr(settings, 'PITHOS_BACKEND_DB_CONNECTION',
53
                                'sqlite:////tmp/pithos-backend.db')
54

    
55
# Block storage.
56
BACKEND_BLOCK_MODULE = getattr(
57
    settings, 'PITHOS_BACKEND_BLOCK_MODULE', 'pithos.backends.lib.hashfiler')
58
BACKEND_BLOCK_PATH = getattr(
59
    settings, 'PITHOS_BACKEND_BLOCK_PATH', '/tmp/pithos-data/')
60
BACKEND_BLOCK_UMASK = getattr(settings, 'PITHOS_BACKEND_BLOCK_UMASK', 0o022)
61

    
62
# Queue for billing.
63
BACKEND_QUEUE_MODULE = getattr(settings, 'PITHOS_BACKEND_QUEUE_MODULE',
64
                               None)  # Example: 'pithos.backends.lib.rabbitmq'
65
BACKEND_QUEUE_HOSTS = getattr(settings, 'PITHOS_BACKEND_QUEUE_HOSTS', None) # Example: "['amqp://guest:guest@localhost:5672']"
66
BACKEND_QUEUE_EXCHANGE = getattr(settings, 'PITHOS_BACKEND_QUEUE_EXCHANGE', 'pithos')
67

    
68
# Default setting for new accounts.
69
BACKEND_ACCOUNT_QUOTA = getattr(
70
    settings, 'PITHOS_BACKEND_ACCOUNT_QUOTA', 50 * 1024 * 1024 * 1024)
71
BACKEND_CONTAINER_QUOTA = getattr(
72
    settings, 'PITHOS_BACKEND_CONTAINER_QUOTA', 0)
73
BACKEND_VERSIONING = getattr(settings, 'PITHOS_BACKEND_VERSIONING', 'auto')
74
BACKEND_FREE_VERSIONING = getattr(settings, 'PITHOS_BACKEND_FREE_VERSIONING', True)
75

    
76
# Default backend pool size
77
BACKEND_POOL_SIZE = getattr(settings, 'PITHOS_BACKEND_POOL_SIZE', 5)
78

    
79
# Update object checksums.
80
UPDATE_MD5 = getattr(settings, 'PITHOS_UPDATE_MD5', False)
81

    
82
# Service Token acquired by identity provider.
83
SERVICE_TOKEN = getattr(settings, 'PITHOS_SERVICE_TOKEN', '')
84

    
85
RADOS_STORAGE = getattr(settings, 'PITHOS_RADOS_STORAGE', False)
86
RADOS_POOL_BLOCKS= getattr(settings, 'PITHOS_RADOS_POOL_BLOCKS', 'blocks')
87
RADOS_POOL_MAPS = getattr(settings, 'PITHOS_RADOS_POOL_MAPS', 'maps')
88

    
89
# This enables a ui compatibility layer for the introduction of UUIDs in
90
# identity management.  WARNING: Setting to True will break your installation.
91
TRANSLATE_UUIDS = getattr(settings, 'PITHOS_TRANSLATE_UUIDS', False)
92

    
93
# Set PROXY_USER_SERVICES to True to have snf-pithos-app handle all Astakos
94
# user-visible services (feedback, login, etc.) by proxying them to a running
95
# Astakos.
96
# Set to False if snf astakos-app is running on the same machine, so it handles
97
# the requests on its own.
98
PROXY_USER_SERVICES = getattr(settings, 'PITHOS_PROXY_USER_SERVICES', True)
99

    
100
# Set how many random bytes to use for constructing the URL of Pithos public files
101
PUBLIC_URL_SECURITY =  getattr(settings, 'PITHOS_PUBLIC_URL_SECURITY', 16)
102
# Set the alphabet to use for constructing the URL of Pithos public files
103
PUBLIC_URL_ALPHABET =  getattr(
104
    settings,
105
    'PITHOS_PUBLIC_URL_ALPHABET',
106
    '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
107
)