Add main function and progress messages with access link
This commit is contained in:
parent
492745e374
commit
ffaf6b43a5
19
main.py
19
main.py
@ -1,7 +1,7 @@
|
|||||||
import requests
|
import requests
|
||||||
from models_vm import VmAccount
|
from models_vm import VmAccount
|
||||||
from models_dci import AuthUser
|
from models_dci import AuthUser
|
||||||
from settings import PLATFORM
|
from settings import CLIENT_HOST, PLATFORM
|
||||||
|
|
||||||
|
|
||||||
class Access(object):
|
class Access(object):
|
||||||
@ -46,9 +46,24 @@ class Access(object):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
|
"""
|
||||||
|
app entrypoint
|
||||||
|
"""
|
||||||
access = Access(PLATFORM)
|
access = Access(PLATFORM)
|
||||||
|
print("Getting an admin account, please waiting....")
|
||||||
account = access.get_admin()
|
account = access.get_admin()
|
||||||
|
print("Account will be used:")
|
||||||
print(account)
|
print(account)
|
||||||
|
print("Getting an access key, please waiting...")
|
||||||
key = access.get_key(account)
|
key = access.get_key(account)
|
||||||
|
print("Key will be used:")
|
||||||
print(key)
|
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()
|
||||||
|
@ -3,6 +3,7 @@ import json
|
|||||||
from peewee import MySQLDatabase
|
from peewee import MySQLDatabase
|
||||||
|
|
||||||
|
|
||||||
|
CLIENT_HOST = os.environ.get("CLIENT_HOST", "replace_to_client_host")
|
||||||
PLATFORM = os.environ.get("PLATFORM", "vm") # or dci
|
PLATFORM = os.environ.get("PLATFORM", "vm") # or dci
|
||||||
|
|
||||||
DB_ENGINE = os.environ.get("DB_ENGINE", "mysql")
|
DB_ENGINE = os.environ.get("DB_ENGINE", "mysql")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user