Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-app / pithos / api / settings.py @ 2a54b2dd

History | View | Annotate | Download (4.2 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.util.keypath import get_path
6
from pithos.api.services import pithos_services
7

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

    
12
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
13

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

    
19
PITHOS_PREFIX = get_path(pithos_services, 'pithos_object-store.prefix')
20
PUBLIC_PREFIX = get_path(pithos_services, 'pithos_public.prefix')
21
UI_PREFIX = get_path(pithos_services, 'pithos_ui.prefix')
22

    
23
CUSTOMIZE_ASTAKOS_SERVICES = \
24
        getattr(settings, 'PITHOS_CUSTOMIZE_ASTAKOS_SERVICES', ())
25
for path, value in CUSTOMIZE_ASTAKOS_SERVICES:
26
    set_path(astakos_services, path, value, createpath=True)
27

    
28
ASTAKOS_ACCOUNT_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
29

    
30
BASE_ASTAKOS_PROXY_PATH = getattr(settings, 'PITHOS_BASE_ASTAKOS_PROXY_PATH',
31
                                  ASTAKOS_BASE_PATH)
32

    
33

    
34
ASTAKOSCLIENT_POOLSIZE = getattr(settings, 'PITHOS_ASTAKOSCLIENT_POOLSIZE', 200)
35

    
36
COOKIE_NAME = getattr(settings, 'PITHOS_ASTAKOS_COOKIE_NAME', '_pithos2_a')
37

    
38
# SQLAlchemy (choose SQLite/MySQL/PostgreSQL).
39
BACKEND_DB_MODULE = getattr(
40
    settings, 'PITHOS_BACKEND_DB_MODULE', 'pithos.backends.lib.sqlalchemy')
41
BACKEND_DB_CONNECTION = getattr(settings, 'PITHOS_BACKEND_DB_CONNECTION',
42
                                'sqlite:////tmp/pithos-backend.db')
43

    
44
# Block storage.
45
BACKEND_BLOCK_MODULE = getattr(
46
    settings, 'PITHOS_BACKEND_BLOCK_MODULE', 'pithos.backends.lib.hashfiler')
47
BACKEND_BLOCK_PATH = getattr(
48
    settings, 'PITHOS_BACKEND_BLOCK_PATH', '/tmp/pithos-data/')
49
BACKEND_BLOCK_UMASK = getattr(settings, 'PITHOS_BACKEND_BLOCK_UMASK', 0o022)
50

    
51
# Queue for billing.
52
BACKEND_QUEUE_MODULE = getattr(settings, 'PITHOS_BACKEND_QUEUE_MODULE',
53
                               None)  # Example: 'pithos.backends.lib.rabbitmq'
54
BACKEND_QUEUE_HOSTS = getattr(settings, 'PITHOS_BACKEND_QUEUE_HOSTS', None) # Example: "['amqp://guest:guest@localhost:5672']"
55
BACKEND_QUEUE_EXCHANGE = getattr(settings, 'PITHOS_BACKEND_QUEUE_EXCHANGE', 'pithos')
56

    
57
# Default setting for new accounts.
58
BACKEND_ACCOUNT_QUOTA = getattr(
59
    settings, 'PITHOS_BACKEND_ACCOUNT_QUOTA', 50 * 1024 * 1024 * 1024)
60
BACKEND_CONTAINER_QUOTA = getattr(
61
    settings, 'PITHOS_BACKEND_CONTAINER_QUOTA', 0)
62
BACKEND_VERSIONING = getattr(settings, 'PITHOS_BACKEND_VERSIONING', 'auto')
63
BACKEND_FREE_VERSIONING = getattr(settings, 'PITHOS_BACKEND_FREE_VERSIONING', True)
64

    
65
# Default backend pool size
66
BACKEND_POOL_SIZE = getattr(settings, 'PITHOS_BACKEND_POOL_SIZE', 5)
67

    
68
# Update object checksums.
69
UPDATE_MD5 = getattr(settings, 'PITHOS_UPDATE_MD5', False)
70

    
71
# Service Token acquired by identity provider.
72
SERVICE_TOKEN = getattr(settings, 'PITHOS_SERVICE_TOKEN', '')
73

    
74
RADOS_STORAGE = getattr(settings, 'PITHOS_RADOS_STORAGE', False)
75
RADOS_POOL_BLOCKS= getattr(settings, 'PITHOS_RADOS_POOL_BLOCKS', 'blocks')
76
RADOS_POOL_MAPS = getattr(settings, 'PITHOS_RADOS_POOL_MAPS', 'maps')
77

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

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

    
89
# Set how many random bytes to use for constructing the URL of Pithos public files
90
PUBLIC_URL_SECURITY =  getattr(settings, 'PITHOS_PUBLIC_URL_SECURITY', 16)
91
# Set the alphabet to use for constructing the URL of Pithos public files
92
PUBLIC_URL_ALPHABET =  getattr(
93
    settings,
94
    'PITHOS_PUBLIC_URL_ALPHABET',
95
    '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
96
)