2022-03-15 16:19:37 +00:00
|
|
|
#!/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
|
2022-03-15 16:19:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
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()
|