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

20 lines
498 B
Python
Raw Normal View History

#!/usr/bin/env python3
from kiwi_vpn_api.config import CRYPT_CONTEXT, DB
from kiwi_vpn_api.db.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()