mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	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:
		@@ -258,7 +258,12 @@ class BaseInvenTreeSetting(models.Model):
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
        setting = cls.get_setting_definition(key, **kwargs)
 | 
					        setting = cls.get_setting_definition(key, **kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return setting.get('default', '')
 | 
					        default = setting.get('default', '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if callable(default):
 | 
				
			||||||
 | 
					            return default()
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            return default
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def get_setting_choices(cls, key, **kwargs):
 | 
					    def get_setting_choices(cls, key, **kwargs):
 | 
				
			||||||
@@ -1345,7 +1350,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
 | 
				
			|||||||
        'PLUGIN_ON_STARTUP': {
 | 
					        'PLUGIN_ON_STARTUP': {
 | 
				
			||||||
            'name': _('Check plugins on startup'),
 | 
					            'name': _('Check plugins on startup'),
 | 
				
			||||||
            'description': _('Check that all plugins are installed on startup - enable in container environments'),
 | 
					            'description': _('Check that all plugins are installed on startup - enable in container environments'),
 | 
				
			||||||
            'default': False,
 | 
					            'default': settings.DOCKER,
 | 
				
			||||||
            'validator': bool,
 | 
					            'validator': bool,
 | 
				
			||||||
            'requires_restart': True,
 | 
					            'requires_restart': True,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user