mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-03-03 00:32:20 +00:00
Add helper function detecting (prebuilt) docker environment
This commit is contained in:
8
freqtrade/configuration/detect_environment.py
Normal file
8
freqtrade/configuration/detect_environment.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def running_in_docker() -> bool:
|
||||||
|
"""
|
||||||
|
Check if we are running in a docker container
|
||||||
|
"""
|
||||||
|
return os.environ.get('FT_APP_ENV') == 'docker'
|
||||||
@@ -3,6 +3,7 @@ import shutil
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from freqtrade.configuration.detect_environment import running_in_docker
|
||||||
from freqtrade.constants import (USER_DATA_FILES, USERPATH_FREQAIMODELS, USERPATH_HYPEROPTS,
|
from freqtrade.constants import (USER_DATA_FILES, USERPATH_FREQAIMODELS, USERPATH_HYPEROPTS,
|
||||||
USERPATH_NOTEBOOKS, USERPATH_STRATEGIES, Config)
|
USERPATH_NOTEBOOKS, USERPATH_STRATEGIES, Config)
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
@@ -30,8 +31,7 @@ def chown_user_directory(directory: Path) -> None:
|
|||||||
Use Sudo to change permissions of the home-directory if necessary
|
Use Sudo to change permissions of the home-directory if necessary
|
||||||
Only applies when running in docker!
|
Only applies when running in docker!
|
||||||
"""
|
"""
|
||||||
import os
|
if running_in_docker():
|
||||||
if os.environ.get('FT_APP_ENV') == 'docker':
|
|
||||||
try:
|
try:
|
||||||
import subprocess
|
import subprocess
|
||||||
subprocess.check_output(
|
subprocess.check_output(
|
||||||
|
|||||||
Reference in New Issue
Block a user