Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-app / pithos / api / settings.py @ fe4ad54f

History | View | Annotate | Download (4.4 kB)

1
#coding=utf8
2
from django.conf import settings
3
from synnefo.lib import parse_base_url
4
from astakosclient import astakos_services
5
from synnefo.lib.services import fill_endpoints
6
from synnefo.util.keypath import get_path
7
from pithos.api.services import pithos_services as vanilla_pithos_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
CUSTOMIZE_ASTAKOS_SERVICES = \
29
        getattr(settings, 'PITHOS_CUSTOMIZE_ASTAKOS_SERVICES', ())
30
for path, value in CUSTOMIZE_ASTAKOS_SERVICES:
31
    set_path(astakos_services, path, value, createpath=True)
32

    
33
ASTAKOS_ACCOUNT_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
34

    
35
BASE_ASTAKOS_PROXY_PATH = getattr(settings, 'PITHOS_BASE_ASTAKOS_PROXY_PATH',
36
                                  ASTAKOS_BASE_PATH)
37

    
38

    
39
ASTAKOSCLIENT_POOLSIZE = getattr(settings, 'PITHOS_ASTAKOSCLIENT_POOLSIZE', 200)
40

    
41
COOKIE_NAME = getattr(settings, 'PITHOS_ASTAKOS_COOKIE_NAME', '_pithos2_a')
42

    
43
# SQLAlchemy (choose SQLite/MySQL/PostgreSQL).
44
BACKEND_DB_MODULE = getattr(
45
    settings, 'PITHOS_BACKEND_DB_MODULE', 'pithos.backends.lib.sqlalchemy')
46
BACKEND_DB_CONNECTION = getattr(settings, 'PITHOS_BACKEND_DB_CONNECTION',
47
                                'sqlite:////tmp/pithos-backend.db')
48

    
49
# Block storage.
50
BACKEND_BLOCK_MODULE = getattr(
51
    settings, 'PITHOS_BACKEND_BLOCK_MODULE', 'pithos.backends.lib.hashfiler')
52
BACKEND_BLOCK_PATH = getattr(
53
    settings, 'PITHOS_BACKEND_BLOCK_PATH', '/tmp/pithos-data/')
54
BACKEND_BLOCK_UMASK = getattr(settings, 'PITHOS_BACKEND_BLOCK_UMASK', 0o022)
55

    
56
# Queue for billing.
57
BACKEND_QUEUE_MODULE = getattr(settings, 'PITHOS_BACKEND_QUEUE_MODULE',
58
                               None)  # Example: 'pithos.backends.lib.rabbitmq'
59
BACKEND_QUEUE_HOSTS = getattr(settings, 'PITHOS_BACKEND_QUEUE_HOSTS', None) # Example: "['amqp://guest:guest@localhost:5672']"
60
BACKEND_QUEUE_EXCHANGE = getattr(settings, 'PITHOS_BACKEND_QUEUE_EXCHANGE', 'pithos')
61

    
62
# Default setting for new accounts.
63
BACKEND_ACCOUNT_QUOTA = getattr(
64
    settings, 'PITHOS_BACKEND_ACCOUNT_QUOTA', 50 * 1024 * 1024 * 1024)
65
BACKEND_CONTAINER_QUOTA = getattr(
66
    settings, 'PITHOS_BACKEND_CONTAINER_QUOTA', 0)
67
BACKEND_VERSIONING = getattr(settings, 'PITHOS_BACKEND_VERSIONING', 'auto')
68
BACKEND_FREE_VERSIONING = getattr(settings, 'PITHOS_BACKEND_FREE_VERSIONING', True)
69

    
70
# Default backend pool size
71
BACKEND_POOL_SIZE = getattr(settings, 'PITHOS_BACKEND_POOL_SIZE', 5)
72

    
73
# Update object checksums.
74
UPDATE_MD5 = getattr(settings, 'PITHOS_UPDATE_MD5', False)
75

    
76
# Service Token acquired by identity provider.
77
SERVICE_TOKEN = getattr(settings, 'PITHOS_SERVICE_TOKEN', '')
78

    
79
RADOS_STORAGE = getattr(settings, 'PITHOS_RADOS_STORAGE', False)
80
RADOS_POOL_BLOCKS= getattr(settings, 'PITHOS_RADOS_POOL_BLOCKS', 'blocks')
81
RADOS_POOL_MAPS = getattr(settings, 'PITHOS_RADOS_POOL_MAPS', 'maps')
82

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

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

    
94
# Set how many random bytes to use for constructing the URL of Pithos public files
95
PUBLIC_URL_SECURITY =  getattr(settings, 'PITHOS_PUBLIC_URL_SECURITY', 16)
96
# Set the alphabet to use for constructing the URL of Pithos public files
97
PUBLIC_URL_ALPHABET =  getattr(
98
    settings,
99
    'PITHOS_PUBLIC_URL_ALPHABET',
100
    '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
101
)