mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
- Properly cast dict values - Fixes https://github.com/inventree/InvenTree/issues/6668 (cherry picked from commit 2926d7596bbc346e564580a039fbb5c17d57c415) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
72dceb28be
commit
40e9b33da6
@ -294,7 +294,10 @@ if LDAP_AUTH:
|
|||||||
|
|
||||||
# get global options from dict and use ldap.OPT_* as keys and values
|
# get global options from dict and use ldap.OPT_* as keys and values
|
||||||
global_options_dict = get_setting(
|
global_options_dict = get_setting(
|
||||||
'INVENTREE_LDAP_GLOBAL_OPTIONS', 'ldap.global_options', {}, dict
|
'INVENTREE_LDAP_GLOBAL_OPTIONS',
|
||||||
|
'ldap.global_options',
|
||||||
|
default_value=None,
|
||||||
|
typecast=dict,
|
||||||
)
|
)
|
||||||
global_options = {}
|
global_options = {}
|
||||||
for k, v in global_options_dict.items():
|
for k, v in global_options_dict.items():
|
||||||
@ -364,7 +367,10 @@ if LDAP_AUTH:
|
|||||||
)
|
)
|
||||||
AUTH_LDAP_DENY_GROUP = get_setting('INVENTREE_LDAP_DENY_GROUP', 'ldap.deny_group')
|
AUTH_LDAP_DENY_GROUP = get_setting('INVENTREE_LDAP_DENY_GROUP', 'ldap.deny_group')
|
||||||
AUTH_LDAP_USER_FLAGS_BY_GROUP = get_setting(
|
AUTH_LDAP_USER_FLAGS_BY_GROUP = get_setting(
|
||||||
'INVENTREE_LDAP_USER_FLAGS_BY_GROUP', 'ldap.user_flags_by_group', {}, dict
|
'INVENTREE_LDAP_USER_FLAGS_BY_GROUP',
|
||||||
|
'ldap.user_flags_by_group',
|
||||||
|
default_value=None,
|
||||||
|
typecast=dict,
|
||||||
)
|
)
|
||||||
AUTH_LDAP_FIND_GROUP_PERMS = True
|
AUTH_LDAP_FIND_GROUP_PERMS = True
|
||||||
|
|
||||||
@ -482,7 +488,7 @@ Configure the database backend based on the user-specified values.
|
|||||||
logger.debug('Configuring database backend:')
|
logger.debug('Configuring database backend:')
|
||||||
|
|
||||||
# Extract database configuration from the config.yaml file
|
# Extract database configuration from the config.yaml file
|
||||||
db_config = CONFIG.get('database', {})
|
db_config = CONFIG.get('database', None)
|
||||||
|
|
||||||
if not db_config:
|
if not db_config:
|
||||||
db_config = {}
|
db_config = {}
|
||||||
@ -558,7 +564,10 @@ Ref: https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-OPTIONS
|
|||||||
# connecting to the database server (such as a replica failover) don't sit and
|
# connecting to the database server (such as a replica failover) don't sit and
|
||||||
# wait for possibly an hour or more, just tell the client something went wrong
|
# wait for possibly an hour or more, just tell the client something went wrong
|
||||||
# and let the client retry when they want to.
|
# and let the client retry when they want to.
|
||||||
db_options = db_config.get('OPTIONS', db_config.get('options', {}))
|
db_options = db_config.get('OPTIONS', db_config.get('options', None))
|
||||||
|
|
||||||
|
if db_options is None:
|
||||||
|
db_options = {}
|
||||||
|
|
||||||
# Specific options for postgres backend
|
# Specific options for postgres backend
|
||||||
if 'postgres' in db_engine: # pragma: no cover
|
if 'postgres' in db_engine: # pragma: no cover
|
||||||
@ -721,7 +730,10 @@ if TRACING_ENABLED: # pragma: no cover
|
|||||||
logger.info('OpenTelemetry tracing enabled')
|
logger.info('OpenTelemetry tracing enabled')
|
||||||
|
|
||||||
_t_resources = get_setting(
|
_t_resources = get_setting(
|
||||||
'INVENTREE_TRACING_RESOURCES', 'tracing.resources', {}, dict
|
'INVENTREE_TRACING_RESOURCES',
|
||||||
|
'tracing.resources',
|
||||||
|
default_value={},
|
||||||
|
typecast=dict,
|
||||||
)
|
)
|
||||||
cstm_tags = {'inventree.env.' + k: v for k, v in inventree_tags.items()}
|
cstm_tags = {'inventree.env.' + k: v for k, v in inventree_tags.items()}
|
||||||
tracing_resources = {**cstm_tags, **_t_resources}
|
tracing_resources = {**cstm_tags, **_t_resources}
|
||||||
@ -733,7 +745,12 @@ if TRACING_ENABLED: # pragma: no cover
|
|||||||
console=get_boolean_setting(
|
console=get_boolean_setting(
|
||||||
'INVENTREE_TRACING_CONSOLE', 'tracing.console', False
|
'INVENTREE_TRACING_CONSOLE', 'tracing.console', False
|
||||||
),
|
),
|
||||||
auth=get_setting('INVENTREE_TRACING_AUTH', 'tracing.auth', {}),
|
auth=get_setting(
|
||||||
|
'INVENTREE_TRACING_AUTH',
|
||||||
|
'tracing.auth',
|
||||||
|
default_value=None,
|
||||||
|
typecast=dict,
|
||||||
|
),
|
||||||
is_http=get_setting('INVENTREE_TRACING_IS_HTTP', 'tracing.is_http', True),
|
is_http=get_setting('INVENTREE_TRACING_IS_HTTP', 'tracing.is_http', True),
|
||||||
append_http=get_boolean_setting(
|
append_http=get_boolean_setting(
|
||||||
'INVENTREE_TRACING_APPEND_HTTP', 'tracing.append_http', True
|
'INVENTREE_TRACING_APPEND_HTTP', 'tracing.append_http', True
|
||||||
@ -1158,7 +1175,9 @@ CUSTOM_SPLASH = get_custom_file(
|
|||||||
'INVENTREE_CUSTOM_SPLASH', 'customize.splash', 'custom splash'
|
'INVENTREE_CUSTOM_SPLASH', 'customize.splash', 'custom splash'
|
||||||
)
|
)
|
||||||
|
|
||||||
CUSTOMIZE = get_setting('INVENTREE_CUSTOMIZE', 'customize', {})
|
CUSTOMIZE = get_setting(
|
||||||
|
'INVENTREE_CUSTOMIZE', 'customize', default_value=None, typecast=dict
|
||||||
|
)
|
||||||
|
|
||||||
# Load settings for the frontend interface
|
# Load settings for the frontend interface
|
||||||
FRONTEND_SETTINGS = config.get_frontend_settings(debug=DEBUG)
|
FRONTEND_SETTINGS = config.get_frontend_settings(debug=DEBUG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user