2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-30 20:55:42 +00:00

Fix default storage target value (#10718)

* Fix default storage target value

* Use enum values for comparison

* Fix typo
This commit is contained in:
Oliver
2025-10-30 14:45:45 +11:00
committed by GitHub
parent 8152ccee99
commit ec9b6e7f84

View File

@@ -26,7 +26,7 @@ def init_storages() -> tuple[str, dict, Optional[str]]:
target = get_setting(
'INVENTREE_STORAGE_TARGET',
'storage.target',
StorageBackends.LOCAL,
StorageBackends.LOCAL.value,
typecast=str,
)
@@ -36,7 +36,7 @@ def init_storages() -> tuple[str, dict, Optional[str]]:
options = {}
media_url: Optional[str] = None
if target == 's3':
if target == StorageBackends.S3.value:
s3_bucket = get_setting(
'INVENTREE_S3_BUCKET_NAME', 'storage.s3.bucket_name', None, typecast=str
)
@@ -79,7 +79,7 @@ def init_storages() -> tuple[str, dict, Optional[str]]:
else 'path',
'object_parameters': {'CacheControl': 'public,max-age=86400'},
}
elif target == 'sftp':
elif target == StorageBackends.SFTP:
options = {
'host': get_setting('INVENTREE_SFTP_HOST', 'sftp.host', None, typecast=str),
'uid': get_setting('INVENTREE_SFTP_UID', 'sftp.uid', None, typecast=int),