-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.py
41 lines (33 loc) · 1.63 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import logging
import uuid
logger = logging.getLogger(__name__)
# try to load config from a top-level module.
try:
import pykitconfig
except ImportError:
pykitconfig = object()
logger.info('pykitconfig not found by "import pykitconfig".'
' Using default config.'
' You can create file "pykitconf.py" to define default config for pykit.')
def _get(key, default=None):
v = getattr(pykitconfig, key, default)
logger.debug('set pykit config: {key}={v}'.format(key=key, v=v))
return v
uid = _get('uid')
gid = _get('gid')
log_dir = _get('log_dir')
cat_stat_dir = _get('cat_stat_dir')
iostat_stat_path = _get('iostat_stat_path', '/tmp/pykit-iostat')
zk_acl = _get('zk_acl') # (('xp', '123', 'cdrwa'), ('foo', 'bar', 'rw'))
zk_auth = _get('zk_auth') # ('digest', 'xp', '123')
zk_hosts = _get('zk_hosts', '127.0.0.1:21811')
zk_lock_dir = _get('zk_lock_dir', 'lock/')
zk_node_id = _get('zk_node_id', '%012x' % uuid.getnode())
zk_record_dir = _get('zk_record_dir', 'record/')
zk_tx_dir = _get('zk_tx_dir', 'tx/')
zk_seq_dir = _get('zk_seq_dir', 'seq/')
zk_tx_timeout = _get('zk_tx_timeout', 365 * 24 * 3600)
rp_cli_nwr = _get('rp_cli_nwr', (3, 2, 2))
rp_cli_ak_sk = _get('rp_cli_ak_sk', ('access_key', 'secret_key'))
ec_block_port = _get('ec_block_port', 6000)
inner_ip_patterns = _get('inner_ip_patterns', ['^172[.]1[6-9].*', '^172[.]2[0-9].*', '^172[.]3[0-1].*', '^10[.].*', '^192[.]168[.].*'])