Configuration
Looking into server folder you will find a file named .env
which is the only file you need to change in this folder.
This file looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | NODE_ENV=prod MAIN_PORT=8080 SQL_HOST=localhost SQL_USER=root SQL_PASSWORD= SQL_DATABASE=taxi REDIS_PORT=6379 REDIS_HOST=localhost REDIS_PASSWORD= GOOGLE_MAPS_API_KEY= STRIPE_SECRET_KEY= PAYMENT_CURRENCY=usd JWT_SECRET=fdsfdsfdsfdsf MAX_DRIVERS_SEND_REQUEST=10 MAX_DISTANCE_TO_SEND_REQUEST=10000 MINIMUM_AMOUNT_TO_REQUEST_PAYMENT=50 PERCENT_FOR_COMPANY=30 CASH_PAYMENT_REDUCES_DRIVER_CREDIT=true DRIVER_MIN_VERSION_IOS=1 RIDER_MIN_VERSION_IOS=1 DRIVER_MIN_VERSION_ANDROID=3 RIDER_MIN_VERSION_ANDROID=3 TEST_MODE=false |
If you want to know what each one of these do i will explain some of them in following sections but first let's fill the mandatory ones to fill.
Important Parameters
SQL_PASSWORD (Important)
In previous section when installing mariaDB you have set a password for your root user in mysql_secure_installation process. Enter it here.
Tip
To make the system more secure you can create a user and limit access of that user to the taxi database. But this will need you to have some knowledge in handling sql. As it is a little bit hard it will be leaved to user to do so if wanted too. SQL_USER
, SQL_DATABASE
, SQL_PASSWORD
arguments help you to even connect to a remote secure database. Choice is up to you.
GOOGLE_MAPS_API_KEY (Important)
For some of geographical functions Google maps has been used. The proccess of retrieving the API key from google maps dashboard has been explained in client section. You can leave this for now and remember to insert the retrieved key here.
Note
Changing this will logout all your users from system and they would have to login again.
Importing database schema
You can do the database migration proccess easily using db-migrate which we have installed before. Do so using following commands:
1 2 | db-migrate db:create taxi db-migrate up |
Starting service
Now you can start server app using this command:
1 | pm2 start server.js --name server --watch &
|
Note
After each reboot you will need to enter this command again to start server application.