Skip to content

Commit

Permalink
🚧 write unique key for config
Browse files Browse the repository at this point in the history
  • Loading branch information
MeditationDuck committed Nov 28, 2024
1 parent caa771c commit 063362f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions wake/cli/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,20 @@ def run_init(
end = time.perf_counter()
console.log(f"[green]Generated pytypes in [bold green]{end - start:.2f} s[/]")

if "wake_remote" not in config.api_keys:
import uuid
wake_remote_key = str(uuid.uuid4())
config.update({"api_keys": {"wake_remote": wake_remote_key}}, [])
# global config path already made when WakeConfig was created
if not config.global_config_path.exists():
with config.global_config_path.open("w") as f:
f.write("[api_keys]\n")
f.write(f'wake_remote = "{config.api_keys["wake_remote"]}"\n')
else:
with config.global_config_path.open("a") as f:
f.write("\n")
f.write(f'wake_remote = "{config.api_keys["wake_remote"]}"\n')

if not config.local_config_path.exists() or force:
write_config(config)

Expand Down

0 comments on commit 063362f

Please sign in to comment.