2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 19:45:46 +00:00

[Feature] Override global settings (#9718)

* Provide mechanism for config to override global settings

* Ensure overrides are observed on save

* Refactor

* Add "read_only" field to serializer

* Prevent editing for read_only settings

* Bump API version

* Update docs

* Secure logs

* Override applies to default_value

* override get_setting method

* Add unit test

* Utilize new approach to override SITE_URL

* Docs updates

* Docs tweaks

* Shortcut for get_global_setting

* Remove previous change

- Allow validation to be performed within the InvenTreeSetting class

* Override INVENTREE_BASE_URL setting

* Handle error on worker boot

* Tweak unit test
This commit is contained in:
Oliver
2025-06-07 20:08:34 +10:00
committed by GitHub
parent 12677ccf22
commit 4b71130ebe
14 changed files with 178 additions and 23 deletions

View File

@ -244,3 +244,11 @@ Refer to the [return order settings](../sales/return_order.md#return-order-setti
### Project Codes
Refer to the [project code settings](../concepts/project_codes.md).
## Override Global Settings
If desired, specific *global settings* can be overridden via environment variables or the configuration file.
Overriding a global setting will mark the setting as "read-only" in the user interface, and prevent it from being changed by user action. Additionally, the associated value stored in the database will be set to the value specified in the override.
Refer to the [configuration guide](../start/config.md#override-global-settings) for more information on how to override global settings.

View File

@ -463,3 +463,13 @@ The following [plugin](../plugins/index.md) configuration options are available:
| INVENTREE_PLUGIN_NOINSTALL | plugin_noinstall | Disable Plugin installation via API - only use plugins.txt file | False |
| INVENTREE_PLUGIN_FILE | plugins_plugin_file | Location of plugin installation file | *Not specified* |
| INVENTREE_PLUGIN_DIR | plugins_plugin_dir | Location of external plugin directory | *Not specified* |
## Override Global Settings
If required, [global settings values](../settings/global.md#override-global-settings) can be overridden by the system administrator.
To override global settings, provide a "dictionary" of settings overrides in the configuration file, or via an environment variable.
| Environment Variable | Configuration File | Description | Default |
| --- | --- | --- | --- |
| GLOBAL_SETTINGS_OVERRIDES | global_settings_overrides | JSON object containing global settings overrides | *Not specified* |