Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-app / pithos / api / settings.py @ 48c5b124

History | View | Annotate | Download (5.4 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 = getattr(settings,
31
                                     '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',
46
                                 200)
47

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

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

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

    
63
# Queue for billing.
64
BACKEND_QUEUE_MODULE = getattr(settings, 'PITHOS_BACKEND_QUEUE_MODULE', None)
65
# Example: 'pithos.backends.lib.rabbitmq'
66

    
67
BACKEND_QUEUE_HOSTS = getattr(settings, 'PITHOS_BACKEND_QUEUE_HOSTS', None)
68
# Example: "['amqp://guest:guest@localhost:5672']"
69

    
70
BACKEND_QUEUE_EXCHANGE = getattr(settings, 'PITHOS_BACKEND_QUEUE_EXCHANGE',
71
                                 'pithos')
72

    
73
# Default setting for new accounts.
74
BACKEND_ACCOUNT_QUOTA = getattr(
75
    settings, 'PITHOS_BACKEND_ACCOUNT_QUOTA', 50 * 1024 * 1024 * 1024)
76
BACKEND_CONTAINER_QUOTA = getattr(
77
    settings, 'PITHOS_BACKEND_CONTAINER_QUOTA', 0)
78
BACKEND_VERSIONING = getattr(settings, 'PITHOS_BACKEND_VERSIONING', 'auto')
79
BACKEND_FREE_VERSIONING = getattr(settings, 'PITHOS_BACKEND_FREE_VERSIONING',
80
                                  True)
81

    
82
# Enable backend pooling
83
BACKEND_POOL_ENABLED = getattr(settings, 'PITHOS_BACKEND_POOL_ENABLED', True)
84

    
85
# Default backend pool size
86
BACKEND_POOL_SIZE = getattr(settings, 'PITHOS_BACKEND_POOL_SIZE', 5)
87

    
88
# Update object checksums.
89
UPDATE_MD5 = getattr(settings, 'PITHOS_UPDATE_MD5', False)
90

    
91
# Service Token acquired by identity provider.
92
SERVICE_TOKEN = getattr(settings, 'PITHOS_SERVICE_TOKEN', '')
93

    
94
RADOS_STORAGE = getattr(settings, 'PITHOS_RADOS_STORAGE', False)
95
RADOS_POOL_BLOCKS = getattr(settings, 'PITHOS_RADOS_POOL_BLOCKS', 'blocks')
96
RADOS_POOL_MAPS = getattr(settings, 'PITHOS_RADOS_POOL_MAPS', 'maps')
97

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

    
102
# Set PROXY_USER_SERVICES to True to have snf-pithos-app handle all Astakos
103
# user-visible services (feedback, login, etc.) by proxying them to a running
104
# Astakos.
105
# Set to False if snf astakos-app is running on the same machine, so it handles
106
# the requests on its own.
107
PROXY_USER_SERVICES = getattr(settings, 'PITHOS_PROXY_USER_SERVICES', True)
108

    
109
# Set how many random bytes to use for constructing the URL
110
# of Pithos public files
111
PUBLIC_URL_SECURITY = getattr(settings, 'PITHOS_PUBLIC_URL_SECURITY', 16)
112
# Set the alphabet to use for constructing the URL of Pithos public files
113
PUBLIC_URL_ALPHABET = getattr(
114
    settings,
115
    'PITHOS_PUBLIC_URL_ALPHABET',
116
    '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
117

    
118
# The maximum number or items returned by the listing api methods
119
API_LIST_LIMIT = getattr(settings, 'PITHOS_API_LIST_LIMIT', 10000)
120

    
121
# The backend block size
122
BACKEND_BLOCK_SIZE = getattr(
123
    settings, 'PITHOS_BACKEND_BLOCK_SIZE', 4 * 1024 * 1024)
124

    
125
# The backend block hash algorithm
126
BACKEND_HASH_ALGORITHM = getattr(
127
    settings, 'PITHOS_BACKEND_HASH_ALGORITHM', 'sha256')
128

    
129
LOGIN_URL = join_urls(ASTAKOS_VIEWS_PREFIX, 'login')