Skip to content

Commit

Permalink
move mongo db setup credentials to a separate script file
Browse files Browse the repository at this point in the history
  • Loading branch information
imda-amdlahir committed Jan 15, 2024
1 parent 7e00516 commit 82254d7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 1 addition & 3 deletions ai-verify-apigw/.env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
MONGODB_URI=mongodb://aiverify:aiverify@localhost:27017/aiverify
DB_HOST=localhost
DB_PORT=27017
# DB_PASSWORD=
# DB_USERNAME=
DB_PORT=27017
6 changes: 6 additions & 0 deletions setup-aiverify/aiverify-dev/db-creds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
export DB_ADMIN_USER="mongodb"
export DB_ADMIN_PASSWORD="mongodb"
export DB_USERNAME="aiverify"
export DB_PASSWORD="aiverify"

11 changes: 7 additions & 4 deletions setup-aiverify/aiverify-dev/setup-aiverify-dev.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
source ./db-creds.sh

# Script to setup the aiverify developer environment

Expand Down Expand Up @@ -105,16 +106,16 @@ else
mongosh << EOF
admin = db.getSiblingDB('admin')
admin.createUser({
user: 'mongodb',
pwd: 'mongodb',
user: '$DB_ADMIN_USER',
pwd: '$DB_ADMIN_PASSWORD',
roles: [{ role: 'root', db: 'admin' }],
});
aiverify = db.getSiblingDB('aiverify')
aiverify.createUser({
user: 'aiverify',
pwd: 'aiverify',
user: '$DB_USERNAME',
pwd: '$DB_PASSWORD',
roles: [{ role: 'readWrite', db: 'aiverify' }],
});
Expand Down Expand Up @@ -159,6 +160,8 @@ cd ..
# Install dependencies - portal
cd ai-verify-portal
cp .env.development .env.local
echo "DB_USERNAME=$DB_USERNAME" >> .env.local
echo "DB_PASSWORD=$DB_PASSWORD" >> .env.local
npm install
sudo npm link ../ai-verify-shared-library
npm run build
Expand Down

0 comments on commit 82254d7

Please sign in to comment.