File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ Both the above commands would install the package globally and `aito` will be av
2525
2626## How to use
2727
28- - ` aito login ` : Login to Aitomatic cloud
28+ - ` aito login ` : Login to Aitomatic cloud
29+ - ` aito logout ` : Logout from Aitomatic cloud
2930- ` aito deploy app <app_name> ` : Deploy app to Aitomatic cluster
3031- ` aito execute app <app_name> ` : Execute app in Aitomatic cluster
3132
Original file line number Diff line number Diff line change 22import json
33from src .execute .main import execute
44from src .deploy .main import deploy
5- from src .login .main import login , CREDENTIAL_FILE
5+ from src .login .main import login
6+ from src .logout .main import logout
7+ from src .constants import CREDENTIAL_FILE
68
79
810def load_config ():
@@ -23,6 +25,7 @@ def cli():
2325
2426
2527cli .add_command (login )
28+ cli .add_command (logout )
2629cli .add_command (execute )
2730cli .add_command (deploy )
2831
Original file line number Diff line number Diff line change 1+ from pathlib import Path
2+
3+
4+ CREDENTIAL_FILE = Path .home ().joinpath ('.aitomatic/credentials' )
Original file line number Diff line number Diff line change 44from http .server import HTTPServer
55import time
66import json
7- from pathlib import Path
87from functools import update_wrapper , partial
98
109from .server import LoginServer
1110from src .utils import get_random_string , create_code_challenger , create_code_verifier
11+ from src .constants import CREDENTIAL_FILE
1212
1313ORG = 'aitomaticinc.us.auth0.com'
1414CLIENT_ID = 'zk9AB0KtNqJY0gVeF1p0ZmUb2tlcXpYq'
1515AUDIENCE = 'https://apps.aitomatic.com/dev'
1616SCOPE = 'openid profile email offline_access'
17- CREDENTIAL_FILE = Path .home ().joinpath ('.aitomatic/credentials' )
1817PORT = 56921
1918
2019
Original file line number Diff line number Diff line change 1+ import click
2+
3+ from src .constants import CREDENTIAL_FILE
4+
5+
6+ @click .command ()
7+ @click .pass_obj
8+ def logout (obj ):
9+ '''Logout from Aitomatic cloud'''
10+ if obj .get ('access_token' ) is not None :
11+ obj ['access_token' ] = None
12+ obj ['refresh_token' ] = None
13+ obj ['id' ] = None
14+ if CREDENTIAL_FILE .exists ():
15+ CREDENTIAL_FILE .unlink ()
16+ click .echo ('Logout successfully. Please login to use other commands.' )
You can’t perform that action at this time.
0 commit comments