Skip to content

Commit

Permalink
add bentoctl helper for copying beacon network config file
Browse files Browse the repository at this point in the history
  • Loading branch information
gsfk committed Sep 17, 2024
1 parent 9d636ca commit 3dc7eb4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion py_bentoctl/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ class InitConfig(SubCommand):
@staticmethod
def add_args(sp):
sp.add_argument(
"service", type=str, choices=["katsu", "beacon"], help="Prepares services for deployment.")
"service",
type=str,
choices=["katsu", "beacon", "beacon-network"],
help="Prepares services for deployment."
)
sp.add_argument(
"--force", "-f", action="store_true",
help="Overwrites any existing config.")
Expand Down
16 changes: 15 additions & 1 deletion py_bentoctl/other_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,14 @@ def init_config(service: str, force: bool = False):
_init_katsu_config(force)
elif service == "beacon":
_init_beacon_config(force)
elif service == "beacon-network":
_init_beacon_network_config(force)


def _init_beacon_config(force: bool):
root_path = pathlib.Path.cwd()
template_dir = (root_path / "etc" / "templates" / "beacon")
dest_dir = (root_path / "lib" / "beacon" / "config")
dest_dir = pathlib.Path(os.environ["BENTO_BEACON_CONFIG_DIR"])

config_template_path = (template_dir / "beacon_config.example.json")
config_dest_path = (dest_dir / "beacon_config.json")
Expand All @@ -644,6 +646,18 @@ def _init_beacon_config(force: bool):
_file_copy(cohort_template_path, cohort_dest_path, force)


def _init_beacon_network_config(force: bool):
root_path = pathlib.Path.cwd()
template_dir = (root_path / "etc" / "templates" / "beacon")
dest_dir = pathlib.Path(os.environ["BENTO_BEACON_CONFIG_DIR"])
print(f"network config dir: {dest_dir}")

network_config_template_path = (template_dir / "beacon_network_config.example.json")
network_config_dest_path = (dest_dir / "beacon_network_config.json")

_file_copy(network_config_template_path, network_config_dest_path, force)


def _init_katsu_config(force: bool):
root_path = pathlib.Path.cwd()
katsu_config_template_path = (root_path / "etc" / "katsu.config.example.json")
Expand Down

0 comments on commit 3dc7eb4

Please sign in to comment.