Add main function and progress messages with access link

This commit is contained in:
Stepan Zhukovsky 2022-09-20 21:46:17 +09:00
parent 492745e374
commit ffaf6b43a5
2 changed files with 18 additions and 2 deletions

19
main.py
View File

@ -1,7 +1,7 @@
import requests
from models_vm import VmAccount
from models_dci import AuthUser
from settings import PLATFORM
from settings import CLIENT_HOST, PLATFORM
class Access(object):
@ -46,9 +46,24 @@ class Access(object):
return result
if __name__ == "__main__":
def main():
"""
app entrypoint
"""
access = Access(PLATFORM)
print("Getting an admin account, please waiting....")
account = access.get_admin()
print("Account will be used:")
print(account)
print("Getting an access key, please waiting...")
key = access.get_key(account)
print("Key will be used:")
print(key)
print("Your access link:")
access_link = 'https://{}/auth/key/{}'.format(CLIENT_HOST, key['key'])
print(access_link)
print("ENJOY MY FRIEND!")
if __name__ == "__main__":
main()

View File

@ -3,6 +3,7 @@ import json
from peewee import MySQLDatabase
CLIENT_HOST = os.environ.get("CLIENT_HOST", "replace_to_client_host")
PLATFORM = os.environ.get("PLATFORM", "vm") # or dci
DB_ENGINE = os.environ.get("DB_ENGINE", "mysql")