kiwi-vpn/api/kiwi_vpn_api/db/create_db.py

19 lines
435 B
Python
Raw Normal View History

#!/usr/bin/env python3
2022-03-15 16:25:07 +00:00
from ..config import CRYPT_CONTEXT, DB
from .model import Certificate, DistinguishedName, User, UserCapability
def main():
DB.connect()
DB.create_tables([Certificate, DistinguishedName, User, UserCapability])
admin = User.create(name="admin", password=CRYPT_CONTEXT.hash("secret"))
UserCapability.create(user=admin, capability="admin")
DB.close()
if __name__ == "__main__":
main()