diff --git a/openprocurement/chronograph/__init__.py b/openprocurement/chronograph/__init__.py index 1e354dd..4e70d55 100644 --- a/openprocurement/chronograph/__init__.py +++ b/openprocurement/chronograph/__init__.py @@ -8,7 +8,7 @@ from couchdb.http import Unauthorized, extract_credentials from datetime import datetime, timedelta #from openprocurement.chronograph.jobstores import CouchDBJobStore -from openprocurement.chronograph.constants import AUCTIONS +from openprocurement.chronograph.constants import DEFAULT_AUCTION_TYPE from openprocurement.chronograph.design import sync_design from openprocurement.chronograph.managers import MANAGERS_MAPPING from openprocurement.chronograph.scheduler import push @@ -111,11 +111,15 @@ def main(global_config, **settings): config.registry.db = db config.registry.manager_mapper = {'types': {}, 'pmts': {}} - for auction in AUCTIONS: - auction_manager = MANAGERS_MAPPING[auction['type']]() - config.registry.manager_mapper['types'][auction['type']] = auction_manager - if auction.get('pmts', []): - config.registry.manager_mapper['pmts'].update({pmt: auction_manager for pmt in auction.get('pmts')}) + auctions = settings.get('auctions', DEFAULT_AUCTION_TYPE).split(',') + for auction in auctions: + auction_manager = MANAGERS_MAPPING[auction]() + config.registry.manager_mapper['types'][auction] = auction_manager + pmts = settings.get(auction) + if pmts: + config.registry.manager_mapper['pmts'].update( + {pmt: auction_manager for pmt in pmts.split(',')} + ) jobstores = { #'default': CouchDBJobStore(database=db_name, client=server) diff --git a/openprocurement/chronograph/constants.py b/openprocurement/chronograph/constants.py index 69fdf65..513dfc0 100644 --- a/openprocurement/chronograph/constants.py +++ b/openprocurement/chronograph/constants.py @@ -26,17 +26,4 @@ 'dutch_streams': 15, 'texas_streams': 20 } - -AUCTIONS = [ - { - 'type': 'insider', - 'pmts': ['dgfInsider', 'sellout.insider'] - }, - { - 'type': 'texas', - 'pmts': ['landLease'] - }, - { - 'type': 'english' - } -] +DEFAULT_AUCTION_TYPE = 'english' diff --git a/openprocurement/chronograph/tests/chronograph.ini b/openprocurement/chronograph/tests/chronograph.ini index d9c8b83..d520d32 100644 --- a/openprocurement/chronograph/tests/chronograph.ini +++ b/openprocurement/chronograph/tests/chronograph.ini @@ -17,6 +17,10 @@ pyramid.default_locale_name = en planning = 1 +auctions = insider,texas,english +insider = dgfInsider,sellout.insider +texas = landLease + [server:main] use = egg:chaussette host = 0.0.0.0 diff --git a/openprocurement/chronograph/utils.py b/openprocurement/chronograph/utils.py index 98cf3fd..fd77b00 100644 --- a/openprocurement/chronograph/utils.py +++ b/openprocurement/chronograph/utils.py @@ -21,7 +21,8 @@ SERVICE_TIME, SMOOTHING_MIN, SMOOTHING_MAX, - DEFAULT_STREAMS_DOC + DEFAULT_STREAMS_DOC, + DEFAULT_AUCTION_TYPE ) POOL = Pool(1) @@ -195,7 +196,7 @@ def get_request(url, auth, session, headers=None): def get_manager_for_auction(auction, mapper): - default_manager = mapper['types'].get('english', None) + default_manager = mapper['types'].get(DEFAULT_AUCTION_TYPE, None) auction_type = auction.get('auctionParameters', {}).get('type', None) if auction_type: