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

18 lines
435 B
Python
Executable file

#!/usr/bin/env python3
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()