mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added helper function to get settings variant
This commit is contained in:
parent
9123994881
commit
698fef2833
3 changed files with 24 additions and 11 deletions
|
|
@ -132,6 +132,7 @@ from .ayon_info import (
|
|||
is_staging_enabled,
|
||||
is_dev_mode_enabled,
|
||||
is_in_tests,
|
||||
get_settings_variant,
|
||||
)
|
||||
|
||||
terminal = Terminal
|
||||
|
|
@ -242,4 +243,5 @@ __all__ = [
|
|||
"is_staging_enabled",
|
||||
"is_dev_mode_enabled",
|
||||
"is_in_tests",
|
||||
"get_settings_variant",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -78,15 +78,15 @@ def is_using_ayon_console():
|
|||
return "ayon_console" in executable_filename
|
||||
|
||||
|
||||
def is_headless_mode_enabled():
|
||||
def is_headless_mode_enabled() -> bool:
|
||||
return os.getenv("AYON_HEADLESS_MODE") == "1"
|
||||
|
||||
|
||||
def is_staging_enabled():
|
||||
def is_staging_enabled() -> bool:
|
||||
return os.getenv("AYON_USE_STAGING") == "1"
|
||||
|
||||
|
||||
def is_in_tests():
|
||||
def is_in_tests() -> bool:
|
||||
"""Process is running in automatic tests mode.
|
||||
|
||||
Returns:
|
||||
|
|
@ -96,7 +96,7 @@ def is_in_tests():
|
|||
return os.environ.get("AYON_IN_TESTS") == "1"
|
||||
|
||||
|
||||
def is_dev_mode_enabled():
|
||||
def is_dev_mode_enabled() -> bool:
|
||||
"""Dev mode is enabled in AYON.
|
||||
|
||||
Returns:
|
||||
|
|
@ -106,6 +106,22 @@ def is_dev_mode_enabled():
|
|||
return os.getenv("AYON_USE_DEV") == "1"
|
||||
|
||||
|
||||
def get_settings_variant() -> str:
|
||||
"""Get AYON settings variant.
|
||||
|
||||
Returns:
|
||||
str: Settings variant.
|
||||
|
||||
"""
|
||||
if is_dev_mode_enabled():
|
||||
return os.environ["AYON_BUNDLE_NAME"]
|
||||
|
||||
if is_staging_enabled():
|
||||
return "staging"
|
||||
|
||||
return "production"
|
||||
|
||||
|
||||
def get_ayon_info():
|
||||
executable_args = get_ayon_launcher_args()
|
||||
if is_running_from_build():
|
||||
|
|
|
|||
|
|
@ -56,14 +56,9 @@ class _AyonSettingsCache:
|
|||
@classmethod
|
||||
def _get_variant(cls):
|
||||
if _AyonSettingsCache.variant is None:
|
||||
from ayon_core.lib import is_staging_enabled, is_dev_mode_enabled
|
||||
|
||||
variant = "production"
|
||||
if is_dev_mode_enabled():
|
||||
variant = cls._get_bundle_name()
|
||||
elif is_staging_enabled():
|
||||
variant = "staging"
|
||||
from ayon_core.lib import get_settings_variant
|
||||
|
||||
variant = get_settings_variant()
|
||||
# Cache variant
|
||||
_AyonSettingsCache.variant = variant
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue