Skip to content

Commit 599e9d1

Browse files
committed
Adding creds json to directory
1 parent 334a454 commit 599e9d1

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

deadend_cli/src/deadend_cli/jsonrpc_server.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
""" JsonRPC server interface """
66
from typing import Any, Dict, AsyncGenerator
77
import json
8+
from pathlib import Path
9+
from importlib.resources import files
10+
import shutil
811
import os
912
from dataclasses import asdict, is_dataclass
1013
from pydantic import TypeAdapter
@@ -72,7 +75,19 @@ def main(
7275
debug=debug,
7376
log_file=log_file
7477
)
75-
78+
# reusable creds
79+
# copy reusable creds to cache
80+
try:
81+
source_creds = files("deadend_cli").joinpath("data", "memory", "reusable_credentials.json")
82+
path_creds = Path(str(source_creds))
83+
except (ImportError, FileNotFoundError):
84+
print("not found.")
85+
path_creds = Path(__file__) / "data" / "memory" / "reusable_credentials.json"
86+
cache_dir = Path.home() / ".cache" / "deadend" / "memory"
87+
cache_dir.mkdir(parents=True, exist_ok=True)
88+
destination_file = cache_dir / "reusable_credentials.json"
89+
if path_creds.exists():
90+
shutil.copy2(path_creds, destination_file)
7691
# setting up tracing
7792
if _phoenix_otel_enabled():
7893
# Register Phoenix OTLP before importing the agent so the global tracer provider

0 commit comments

Comments
 (0)