# Environment Configuration

### Mail Configuration

For mail configuration, you need to set up your SMTP credential in the .env file in api code

```
#
# Mail
#

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com 
MAIL_USERNAME="spurt123@gmail.com"    #--Your Email Id
MAIL_PASSWORD= "spurt123&"           #--Your Email Password 
MAIL_PORT=465
MAIL_SECURE=true
MAIL_ENCRYPTION=tls
MAIL_FROM="Test-noreply@gmail.com"
```

### Environment Variables <a href="#environment-variables" id="environment-variables"></a>

### Database Configuration

we are using MySQL database, we need to configure database credentials in the .env file&#x20;

```
#
# MySQL DATABASE
#
TYPEORM_CONNECTION=mysql
TYPEORM_HOST=localhost
TYPEORM_PORT=3306
TYPEORM_USERNAME= "testuser"             #--Your MySql Username
TYPEORM_PASSWORD= "spurt123&"		#--Your MySql Password 
TYPEORM_DATABASE= "spurt_commerce"	#--Your Database Name
TYPEORM_SYNCHRONIZE=false
TYPEORM_LOGGING=["query", "error"]
TYPEORM_LOGGER=advanced-console
```

### JWT Configuration

Here are some scenarios where JSON Web Tokens are useful:

* In your API code, Locate .env file and include a config variable "JWT\_SECRET" (if not present already) and set a random string as config value (e.g:2345@#$%678$%^&\*abndutyth89?)()#$@\&naagw) for this variable.

&#x20;JWT token for authorization will be created  with help of this secret key.

```
JWT_SECRET = "2345@#$%678$%^&*abndutyth89?)()#$@&naagw"   #set your own secret key
```

### Crypto Configuration

Here we are using crypto for encrypting and decrypting of the JWT token

```
CRYPTO_SECRET ="as$*908wert3@^(&*asdeaassdod3?)()#$@&SYU"   #set your own secret key
```

### For S3 storage

set your aws S3 credential in .env and .env production file

```
#
# AWS S3 Bucket
#
AWS_ACCESS_KEY_ID="GHTWEDRC4VPO26ASERTY"     #your AWS access keyID
AWS_SECRET_ACCESS_KEY="AeADwer+s4ubL1edvcKtgVBverdfgv+hnp272h0j"   #your AWS secret access code
AWS_DEFAULT_REGION="uk-west-4"      #AWS default region ID
AWS_BUCKET= "name-image"            # your AWS bucket name
#
# File Upload System (local or s3)
#
IMAGE_SERVER = "s3"          #your aws image server name
```

&#x20;set the below urls in **.env** file.&#x20;

```
# after payment success, it will redirect to order list page of react store
STORE_URL = http://localhost:3000/account/myorders
# after payment cancel, it will redirect to home page of react store
CANCEL_URL = http://localhost:4205/
# its is api base url
BASE_URL = http://localhost:8000
# In email template redirection to store
STORE_REDIRECT_URL= https://localhost:3000/
# In email template redirection to admin
ADMIN_REDIRECT_URL= https://localhost:4200/
# In email template redirection to vendor
VENDOR_REDIRECT_URL= https://localhost:5000/
# image resize url
IMAGE_URL= https://localhost:8000/api/media/image-resize/
# Store forget password link
STORE_FORGET_PASSWORD_URL = http://localhost:3000/setPassword/
# Vendor forget password link
FORGET_PASSWORD_URL= http://localhost:5000/#/auth/set-password/
```
