ChandimaPrabath commited on
Commit
c598104
·
1 Parent(s): fdce0db
Files changed (1) hide show
  1. main.py +7 -2
main.py CHANGED
@@ -149,8 +149,13 @@ async def create_user(username: str, password: str, email: Optional[str] = None)
149
 
150
  # Initialize system user
151
  async def init_system_user():
152
- await create_user(SYSTEM_USER, hash_password(SYSTEM_PASSWORD), None)
153
-
 
 
 
 
 
154
 
155
  @root_router.get("/", status_code=status.HTTP_200_OK)
156
  async def root():
 
149
 
150
  # Initialize system user
151
  async def init_system_user():
152
+ try:
153
+ await create_user(SYSTEM_USER, hash_password(SYSTEM_PASSWORD), None)
154
+ except HTTPException as e:
155
+ if e.status_code == status.HTTP_400_BAD_REQUEST and "Username already exists" in e.detail:
156
+ print("System user already exists, continuing...")
157
+ else:
158
+ raise e
159
 
160
  @root_router.get("/", status_code=status.HTTP_200_OK)
161
  async def root():