Skip to content

Commit cb24be3

Browse files
prateekj117mrsaicharan1
authored andcommitted
Read from environment variables when creating the super admin user
1 parent 07df0dd commit cb24be3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

manage.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,18 @@ def initialize_db(credentials):
7979
print("[LOG] Could not create tables. Either database does not exist or tables already created")
8080
if populate_data:
8181
credentials = credentials.split(":")
82-
create_super_admin(credentials[0], credentials[1])
82+
admin_email = os.environ.get('SUPER_ADMIN_EMAIL', credentials[0])
83+
admin_password = os.environ.get('SUPER_ADMIN_PASSWORD', credentials[1])
84+
create_super_admin(admin_email, admin_password)
8385
populate()
8486
else:
8587
print("[LOG] Tables already exist. Skipping data population & creation.")
8688

8789

8890
@manager.command
89-
def prepare_kubernetes_db():
91+
def prepare_kubernetes_db(credentials='[email protected]:fossasia'):
9092
with app.app_context():
91-
initialize_db('[email protected]:fossasia')
93+
initialize_db(credentials)
9294

9395

9496
if __name__ == "__main__":

0 commit comments

Comments
 (0)