refactor: improve frontend env file setup logic and error handling (#2544)
This commit is contained in:
committed by
GitHub
parent
2ed14f42e7
commit
07bf256779
@@ -125,23 +125,23 @@ def run_ui() -> None:
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (frontend_dir / ".env").exists():
|
frontend_env_path = frontend_dir / ".env"
|
||||||
|
if not frontend_env_path.exists():
|
||||||
console.print("[bold blue]Setting up frontend .env file...[/bold blue]")
|
console.print("[bold blue]Setting up frontend .env file...[/bold blue]")
|
||||||
shutil.copy(frontend_dir / ".env.example", frontend_dir / ".env")
|
shutil.copy(frontend_dir / ".env.example", frontend_env_path)
|
||||||
main_env_path = current_dir / ".env"
|
|
||||||
if main_env_path.exists():
|
|
||||||
load_dotenv(main_env_path)
|
|
||||||
skyvern_api_key = os.getenv("SKYVERN_API_KEY")
|
|
||||||
if skyvern_api_key:
|
|
||||||
frontend_env_path = frontend_dir / ".env"
|
|
||||||
set_key(str(frontend_env_path), "VITE_SKYVERN_API_KEY", skyvern_api_key)
|
|
||||||
else:
|
|
||||||
console.print("[red]ERROR: SKYVERN_API_KEY not found in .env file[/red]")
|
|
||||||
else:
|
|
||||||
console.print("[red]ERROR: .env file not found[/red]")
|
|
||||||
|
|
||||||
console.print("✅ [green]Successfully set up frontend .env file[/green]")
|
console.print("✅ [green]Successfully set up frontend .env file[/green]")
|
||||||
|
|
||||||
|
main_env_path = current_dir / ".env"
|
||||||
|
if main_env_path.exists():
|
||||||
|
load_dotenv(main_env_path)
|
||||||
|
skyvern_api_key = os.getenv("SKYVERN_API_KEY")
|
||||||
|
if skyvern_api_key:
|
||||||
|
set_key(str(frontend_env_path), "VITE_SKYVERN_API_KEY", skyvern_api_key)
|
||||||
|
else:
|
||||||
|
console.print("[red]ERROR: SKYVERN_API_KEY not found in .env file[/red]")
|
||||||
|
else:
|
||||||
|
console.print("[red]ERROR: .env file not found[/red]")
|
||||||
|
|
||||||
os.chdir(frontend_dir)
|
os.chdir(frontend_dir)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user