Skip to content

Commit

Permalink
bug #24
Browse files Browse the repository at this point in the history
  • Loading branch information
Flora-Network committed Jul 9, 2021
1 parent ce18337 commit 7fbb04c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions flora/cmds/init_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,16 @@ def flora_full_version_str() -> str:


def flora_init(root_path: Path):
if os.environ.get("CHIA_ROOT", None) is not None:
if os.environ.get("FLORA_ROOT", None) is not None:
print(
f"warning, your CHIA_ROOT is set to {os.environ['CHIA_ROOT']}. "
f"warning, your FLORA_ROOT is set to {os.environ['FLORA_ROOT']}. "
f"Please unset the environment variable and run flora init again\n"
f"or manually migrate config.yaml"
)

print(f"Flora directory {root_path}")
if root_path.is_dir() and Path(root_path / "config" / "config.yaml").exists():
# This is reached if CHIA_ROOT is set, or if user has run flora init twice
# This is reached if FLORA_ROOT is set, or if user has run flora init twice
# before a new update.
check_keys(root_path)
print(f"{root_path} already exists, no migration action taken")
Expand Down
2 changes: 1 addition & 1 deletion flora/cmds/start_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


def launch_start_daemon(root_path: Path) -> subprocess.Popen:
os.environ["CHIA_ROOT"] = str(root_path)
os.environ["FLORA_ROOT"] = str(root_path)
# TODO: use startupinfo=subprocess.DETACHED_PROCESS on windows
flora = sys.argv[0]
process = subprocess.Popen(f"{flora} run_daemon".split(), stdout=subprocess.PIPE)
Expand Down
12 changes: 6 additions & 6 deletions flora/daemon/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ def plotter_log_path(root_path: Path, id: str):


def launch_plotter(root_path: Path, service_name: str, service_array: List[str], id: str):
# we need to pass on the possibly altered CHIA_ROOT
os.environ["CHIA_ROOT"] = str(root_path)
# we need to pass on the possibly altered FLORA_ROOT
os.environ["FLORA_ROOT"] = str(root_path)
service_executable = executable_for_service(service_array[0])

# Swap service name with name of executable
Expand Down Expand Up @@ -799,14 +799,14 @@ def launch_service(root_path: Path, service_command) -> Tuple[subprocess.Popen,
"""
Launch a child process.
"""
# set up CHIA_ROOT
# set up FLORA_ROOT
# invoke correct script
# save away PID

# we need to pass on the possibly altered CHIA_ROOT
os.environ["CHIA_ROOT"] = str(root_path)
# we need to pass on the possibly altered FLORA_ROOT
os.environ["FLORA_ROOT"] = str(root_path)

log.debug(f"Launching service with CHIA_ROOT: {os.environ['CHIA_ROOT']}")
log.debug(f"Launching service with FLORA_ROOT: {os.environ['FLORA_ROOT']}")

# Insert proper e
service_array = service_command.split()
Expand Down
2 changes: 1 addition & 1 deletion flora/util/default_root.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
from pathlib import Path

DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_ROOT", "~/.flora/mainnet"))).resolve()
DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("FLORA_ROOT", "~/.flora/mainnet"))).resolve()

0 comments on commit 7fbb04c

Please sign in to comment.