From bcbea37fce8b9162bfcc7142361e08e7f5c7c63f Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 7 Aug 2014 13:45:15 -0400 Subject: [PATCH] Change distributed config format to make it easier for the setup tool --- config.py | 4 ++-- storage/__init__.py | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/config.py b/config.py index c6637a7ef..bdf4f5e35 100644 --- a/config.py +++ b/config.py @@ -150,8 +150,8 @@ class DefaultConfig(object): FEATURE_GITHUB_BUILD = False DISTRIBUTED_STORAGE_CONFIG = { - 'local_eu': ['LocalStorage', 'test/data/registry/eu'], - 'local_us': ['LocalStorage', 'test/data/registry/us'], + 'local_eu': ['LocalStorage', {'storage_path': 'test/data/registry/eu'}], + 'local_us': ['LocalStorage', {'storage_path': 'test/data/registry/us'}], } DISTRIBUTED_STORAGE_PREFERENCE = ['local_us'] diff --git a/storage/__init__.py b/storage/__init__.py index 163a72355..57e383f1c 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -13,17 +13,15 @@ class Storage(object): self.state = None def init_app(self, app): - # storage_type = app.config.get('STORAGE_TYPE', 'LocalStorage') - # path = app.config.get('STORAGE_PATH', '') - storages = {} for location, storage_params in app.config.get('DISTRIBUTED_STORAGE_CONFIG').items(): driver = storage_params[0] + parameters = storage_params[1] if driver == 'LocalStorage': - storage = LocalStorage(*storage_params[1:]) + storage = LocalStorage(**parameters) elif driver == 'S3Storage': - storage = S3Storage(*storage_params[1:]) + storage = S3Storage(**parameters) else: storage = FakeStorage()