Change distributed config format to make it easier for the setup tool
This commit is contained in:
parent
979f78f677
commit
bcbea37fce
2 changed files with 5 additions and 7 deletions
|
@ -150,8 +150,8 @@ class DefaultConfig(object):
|
||||||
FEATURE_GITHUB_BUILD = False
|
FEATURE_GITHUB_BUILD = False
|
||||||
|
|
||||||
DISTRIBUTED_STORAGE_CONFIG = {
|
DISTRIBUTED_STORAGE_CONFIG = {
|
||||||
'local_eu': ['LocalStorage', 'test/data/registry/eu'],
|
'local_eu': ['LocalStorage', {'storage_path': 'test/data/registry/eu'}],
|
||||||
'local_us': ['LocalStorage', 'test/data/registry/us'],
|
'local_us': ['LocalStorage', {'storage_path': 'test/data/registry/us'}],
|
||||||
}
|
}
|
||||||
|
|
||||||
DISTRIBUTED_STORAGE_PREFERENCE = ['local_us']
|
DISTRIBUTED_STORAGE_PREFERENCE = ['local_us']
|
||||||
|
|
|
@ -13,17 +13,15 @@ class Storage(object):
|
||||||
self.state = None
|
self.state = None
|
||||||
|
|
||||||
def init_app(self, app):
|
def init_app(self, app):
|
||||||
# storage_type = app.config.get('STORAGE_TYPE', 'LocalStorage')
|
|
||||||
# path = app.config.get('STORAGE_PATH', '')
|
|
||||||
|
|
||||||
storages = {}
|
storages = {}
|
||||||
for location, storage_params in app.config.get('DISTRIBUTED_STORAGE_CONFIG').items():
|
for location, storage_params in app.config.get('DISTRIBUTED_STORAGE_CONFIG').items():
|
||||||
driver = storage_params[0]
|
driver = storage_params[0]
|
||||||
|
parameters = storage_params[1]
|
||||||
|
|
||||||
if driver == 'LocalStorage':
|
if driver == 'LocalStorage':
|
||||||
storage = LocalStorage(*storage_params[1:])
|
storage = LocalStorage(**parameters)
|
||||||
elif driver == 'S3Storage':
|
elif driver == 'S3Storage':
|
||||||
storage = S3Storage(*storage_params[1:])
|
storage = S3Storage(**parameters)
|
||||||
else:
|
else:
|
||||||
storage = FakeStorage()
|
storage = FakeStorage()
|
||||||
|
|
||||||
|
|
Reference in a new issue