Docker plugin config (#3977)

* Make setting default values callable

* Update default value for 'PLUGIN_ON_STARTUP' setting

- Defaults to True if running in docker
This commit is contained in:
Oliver 2022-11-21 22:32:04 +11:00 committed by GitHub
parent b43729dca3
commit fbf4b756ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -258,7 +258,12 @@ class BaseInvenTreeSetting(models.Model):
"""
setting = cls.get_setting_definition(key, **kwargs)
return setting.get('default', '')
default = setting.get('default', '')
if callable(default):
return default()
else:
return default
@classmethod
def get_setting_choices(cls, key, **kwargs):
@ -1345,7 +1350,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
'PLUGIN_ON_STARTUP': {
'name': _('Check plugins on startup'),
'description': _('Check that all plugins are installed on startup - enable in container environments'),
'default': False,
'default': settings.DOCKER,
'validator': bool,
'requires_restart': True,
},