Skip to content

Commit 784059f

Browse files
author
even-wei
committed
Align on RECCE_API_TOKEN
Signed-off-by: even-wei <evenwei@infuseai.io>
1 parent d907d6f commit 784059f

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

recce/cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def _add_options(func):
226226
"--api-token",
227227
help="The personal token generated by Recce Cloud.",
228228
type=click.STRING,
229-
envvar="RECCE_CLOUD_API_TOKEN",
229+
envvar="RECCE_API_TOKEN",
230230
)
231231
]
232232

@@ -1311,7 +1311,7 @@ def delete_artifacts(**kwargs):
13111311

13121312

13131313
@cloud.command(cls=TrackCommand, name="list-organizations")
1314-
@click.option("--api-token", help="The Recce Cloud API token.", type=click.STRING, envvar="RECCE_CLOUD_API_TOKEN")
1314+
@click.option("--api-token", help="The Recce Cloud API token.", type=click.STRING, envvar="RECCE_API_TOKEN")
13151315
@add_options(recce_options)
13161316
def list_organizations(**kwargs):
13171317
"""
@@ -1367,7 +1367,7 @@ def list_organizations(**kwargs):
13671367
type=click.STRING,
13681368
envvar="RECCE_ORGANIZATION_ID",
13691369
)
1370-
@click.option("--api-token", help="The Recce Cloud API token.", type=click.STRING, envvar="RECCE_CLOUD_API_TOKEN")
1370+
@click.option("--api-token", help="The Recce Cloud API token.", type=click.STRING, envvar="RECCE_API_TOKEN")
13711371
@add_options(recce_options)
13721372
def list_projects(**kwargs):
13731373
"""
@@ -1449,7 +1449,7 @@ def list_projects(**kwargs):
14491449
type=click.STRING,
14501450
envvar="RECCE_PROJECT_ID",
14511451
)
1452-
@click.option("--api-token", help="The Recce Cloud API token.", type=click.STRING, envvar="RECCE_CLOUD_API_TOKEN")
1452+
@click.option("--api-token", help="The Recce Cloud API token.", type=click.STRING, envvar="RECCE_API_TOKEN")
14531453
@add_options(recce_options)
14541454
def list_sessions(**kwargs):
14551455
"""
@@ -1563,7 +1563,7 @@ def artifact(**kwargs):
15631563
"--api-token",
15641564
help="The personal token generated by Recce Cloud.",
15651565
type=click.STRING,
1566-
envvar="RECCE_CLOUD_API_TOKEN",
1566+
envvar="RECCE_API_TOKEN",
15671567
)
15681568
def share(state_file, **kwargs):
15691569
"""

recce/state/cloud.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ..event import get_recce_api_token
1414
from ..models import CheckDAO
1515
from .const import (
16-
RECCE_CLOUD_API_TOKEN_MISSING,
16+
RECCE_API_TOKEN_MISSING,
1717
RECCE_CLOUD_PASSWORD_MISSING,
1818
RECCE_CLOUD_TOKEN_MISSING,
1919
RECCE_STATE_COMPRESSED_FILE,
@@ -66,8 +66,8 @@ def verify(self) -> bool:
6666
return False
6767
elif self.catalog == "preview":
6868
if self.cloud_options.get("api_token") is None:
69-
self.error_message = RECCE_CLOUD_API_TOKEN_MISSING.error_message
70-
self.hint_message = RECCE_CLOUD_API_TOKEN_MISSING.hint_message
69+
self.error_message = RECCE_API_TOKEN_MISSING.error_message
70+
self.hint_message = RECCE_API_TOKEN_MISSING.hint_message
7171
return False
7272
if self.cloud_options.get("share_id") is None:
7373
self.error_message = "No share ID is provided for the preview catalog."
@@ -77,8 +77,8 @@ def verify(self) -> bool:
7777
return False
7878
elif self.catalog == "session":
7979
if self.cloud_options.get("api_token") is None:
80-
self.error_message = RECCE_CLOUD_API_TOKEN_MISSING.error_message
81-
self.hint_message = RECCE_CLOUD_API_TOKEN_MISSING.hint_message
80+
self.error_message = RECCE_API_TOKEN_MISSING.error_message
81+
self.hint_message = RECCE_API_TOKEN_MISSING.hint_message
8282
return False
8383
if self.cloud_options.get("session_id") is None:
8484
self.error_message = "No session ID is provided for the session catalog."
@@ -614,8 +614,8 @@ def __init__(self, auth_options: Optional[Dict[str, str]] = None):
614614

615615
def verify(self) -> bool:
616616
if get_recce_api_token() is None:
617-
self.error_message = RECCE_CLOUD_API_TOKEN_MISSING.error_message
618-
self.hint_message = RECCE_CLOUD_API_TOKEN_MISSING.hint_message
617+
self.error_message = RECCE_API_TOKEN_MISSING.error_message
618+
self.hint_message = RECCE_API_TOKEN_MISSING.hint_message
619619
return False
620620
return True
621621

recce/state/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ErrorMessage:
2020
hint_message='Please provide a password with the option "--password <compress-password>"',
2121
)
2222

23-
RECCE_CLOUD_API_TOKEN_MISSING = ErrorMessage(
23+
RECCE_API_TOKEN_MISSING = ErrorMessage(
2424
error_message="No Recce API token is provided",
2525
hint_message="Please login to Recce Cloud and copy the API token from the settings page",
2626
)

recce/state/state_loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from recce.pull_request import fetch_pr_metadata
99

1010
from ..util.io import SupportedFileTypes, file_io_factory
11-
from .const import RECCE_CLOUD_API_TOKEN_MISSING
11+
from .const import RECCE_API_TOKEN_MISSING
1212
from .state import RecceState
1313

1414
logger = logging.getLogger("uvicorn")
@@ -53,7 +53,7 @@ def __init__(
5353
self.catalog = "preview"
5454
self.share_id = self.cloud_options.get("share_id")
5555
else:
56-
raise RecceException(RECCE_CLOUD_API_TOKEN_MISSING.error_message)
56+
raise RecceException(RECCE_API_TOKEN_MISSING.error_message)
5757

5858
@property
5959
def token(self):

0 commit comments

Comments
 (0)