2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-13 02:25:38 +00:00

Add devcontainer flag (#9758)

This commit is contained in:
Oliver
2025-06-12 08:40:50 +10:00
committed by GitHub
parent faec2e2050
commit 62552918d0
2 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,7 @@ services:
INVENTREE_SITE_URL: http://localhost:8000
INVENTREE_CORS_ORIGIN_ALLOW_ALL: True
INVENTREE_PY_ENV: /home/inventree/dev/venv
INVENTREE_DEVCONTAINER: True
depends_on:
- db

View File

@ -22,6 +22,11 @@ def is_true(x):
return str(x).strip().lower() in ['1', 'y', 'yes', 't', 'true', 'on']
def is_devcontainer_environment():
"""Check if the InvenTree environment is running in a development container."""
return is_true(os.environ.get('INVENTREE_DEVCONTAINER', 'False'))
def is_docker_environment():
"""Check if the InvenTree environment is running in a Docker container."""
return is_true(os.environ.get('INVENTREE_DOCKER', 'False'))
@ -217,7 +222,7 @@ def envcheck_invoke_cmd():
intendded = ['/bin/invoke', '/bin/inv']
correct_cmd: Optional[str] = None
if is_rtd_environment() or is_docker_environment():
if is_rtd_environment() or is_docker_environment() or is_devcontainer_environment():
pass
elif is_pkg_installer(load_content=True) and not is_pkg_installer_by_path():
correct_cmd = 'inventree run invoke'