Skip to content

Commit

Permalink
Customize config loader
Browse files Browse the repository at this point in the history
* allow to import B2SHARE custom config loader from admin module
  • Loading branch information
gek20 authored and hjhsalo committed Oct 19, 2022
1 parent ec9d710 commit b948ef8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion b2share/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@

env_prefix = 'B2SHARE'

config_loader = create_conf_loader(config=config, env_prefix=env_prefix)
try:
from b2share.admin import b2share_config_loader
config_loader=b2share_config_loader
except (ModuleNotFoundError,ImportError):
# Error handling
config_loader = create_conf_loader(config=config, env_prefix=env_prefix)
pass

instance_path = os.getenv(env_prefix + '_INSTANCE_PATH') or \
os.path.join(sys.prefix, 'var', 'b2share-instance')
Expand Down

0 comments on commit b948ef8

Please sign in to comment.