2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 20:15:44 +00:00

Ensure schema generation is more stable (#7562)

* Enable passing of enviroment variables

* keep server url static
see #6882 (3)

* keep plugin api out of schema
see #6882 (1)

* Add kwarg to override db settings

* keep currencies stable for schema generation
see #6882 (2)

* use str instead of bool

* add version bump
This commit is contained in:
Matthias Mair
2024-07-06 14:19:58 +02:00
committed by GitHub
parent 71680f6fc3
commit 74d3e28e8e
4 changed files with 36 additions and 6 deletions

View File

@ -1,11 +1,14 @@
"""InvenTree API version information."""
# InvenTree API version
INVENTREE_API_VERSION = 211
INVENTREE_API_VERSION = 212
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """
v212 - 2024-07-06 : https://github.com/inventree/InvenTree/pull/7562
- Makes API generation more robust (no functional changes)
v211 - 2024-06-26 : https://github.com/inventree/InvenTree/pull/6911
- Adds API endpoints for managing data import and export

View File

@ -59,7 +59,9 @@ def currency_codes() -> list:
"""Returns the current currency codes."""
from common.settings import get_global_setting
codes = get_global_setting('CURRENCY_CODES', create=False).strip()
codes = get_global_setting(
'CURRENCY_CODES', create=False, enviroment_key='INVENTREE_CURRENCY_CODES'
).strip()
if not codes:
codes = currency_codes_default_list()

View File

@ -1,10 +1,17 @@
"""User-configurable settings for the common app."""
from os import environ
def get_global_setting(key, backup_value=None, **kwargs):
def get_global_setting(key, backup_value=None, enviroment_key=None, **kwargs):
"""Return the value of a global setting using the provided key."""
from common.models import InvenTreeSetting
if enviroment_key:
value = environ.get(enviroment_key)
if value:
return value
if backup_value is not None:
kwargs['backup_value'] = backup_value