Skip to content

Commit 331b340

Browse files
committed
chore: remove unused imports and code
1 parent 92b557d commit 331b340

File tree

1 file changed

+1
-39
lines changed

1 file changed

+1
-39
lines changed

src/phase/utils/misc.py

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,7 @@
1-
import os
21
import platform
3-
import subprocess
4-
import webbrowser
52
import getpass
6-
import json
73
from .exceptions import EnvironmentNotFoundException
8-
from urllib.parse import urlparse
9-
from typing import Union, List
10-
from .const import __version__, PHASE_CLOUD_API_HOST, cross_env_pattern, local_ref_pattern
11-
12-
13-
def get_default_user_token() -> str:
14-
"""
15-
Fetch the default user's personal access token from the config file in PHASE_SECRETS_DIR.
16-
17-
Returns:
18-
- str: The default user's personal access token.
19-
20-
Raises:
21-
- ValueError: If the config file is not found, the default user's ID is missing, or the token is not set.
22-
"""
23-
config_file_path = os.path.join(PHASE_SECRETS_DIR, 'config.json')
24-
25-
if not os.path.exists(config_file_path):
26-
raise ValueError("Config file not found. Please login with phase auth or supply a PHASE_SERVICE_TOKEN as an environment variable.")
27-
28-
with open(config_file_path, 'r') as f:
29-
config_data = json.load(f)
30-
31-
default_user_id = config_data.get("default-user")
32-
if not default_user_id:
33-
raise ValueError("Default user ID is missing in the config file.")
34-
35-
for user in config_data.get("phase-users", []):
36-
if user['id'] == default_user_id:
37-
token = user.get("token")
38-
if not token:
39-
raise ValueError(f"Token for the default user (ID: {default_user_id}) is not found in the config file.")
40-
return token
41-
42-
raise ValueError("Default user not found in the config file.")
4+
from .const import __version__
435

446

457
def phase_get_context(user_data, app_name=None, env_name=None, app_id=None):

0 commit comments

Comments
 (0)