<!-- Source: https://www.wappi.dev/configuration -->

# Configuration

## Project Configuration

Wappi uses a `wappi.json` file for project configuration.

#### API Key

This is the key that Wappi has generated for the API key. This key is used in the authKey.
If your API is ever compromised, change this API key immediately.
*Rebuild when you change this*

```json
"apiKey": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4687121gj2hg3hj12g",
```

#### Auth Rotation

Wappi will automatically rotate the auth key, based on this timing.
You should set this to a time that you want to force logout the user. For high security apps, 10 mins, but for less security needs, you can set it up to 6 months. 30 days is the max recommended time.
Follow the CRON timing:

| Minute | Hour | Day of Month | Month | Day of Week |
| --- | --- | --- | --- | --- |
| 0-59 | 0-23 | 1-31 | 1-12 | 0-6 (Sun=0) |

```json
"authRotation": "*/30 * * * *",
```

#### Deployment

Deployment is used as a flag for a future feature, to help streamline the deployment process. Still a work in progress.

```json
"deployment": "scalingAwsEC2",
```

#### Whitelist Domains

Wappi will automatically lock your API calls to domains in this string list.
It will automatically check the `request.headers.from` value for a match.
If your API is public and you want all types of domains hitting it, leave this as an empty string.

```json
"domains": "mydomain.com, mydomain.org, www.mydomain.com, www.mydomain.org",
```

#### Private or Public API

If your API is a private API, you can set this to true. This will make it unaccessible to calls that are not from your "domains".
This will mean that only the domains listed will have access. If there are no domains listed, it will not work.

```json
"private": false,
```

#### Port

This is the port that wappi will run on.
Allows you to change it if you have other APIs or projects with conflicting ports running locally.

```json
"port": 3030,
```

#### Prisma

If you are using [Prisma ORM](https://www.prisma.io/), then the prisma object build will be intergrated with your API and be available on each endpoint as part of the DB object.

```json
"prisma": true,
```

#### CI/CD

Currently we only support gitlab as a CI/CD pipeline. When setting up your API, if you use gitlab, it will add in the CI/CD basic setup. So you can easily deploy to AWS.

```json
"repository": "gitlab",
```

#### Routing

Currently we only have default routing. This means that it will auto route every call through auth (if required) and figure out the routing automatically.

```json
"routing": "default",
```

#### Name & Description

This is the name and description for the app, that also gets added to the package.json on init.

```json
"serviceName": "My Simple API",
"serviceDescription": "API for my awesome App",
```

#### MySQL

If you are using SQL, the connection data object will be added to the `db: DB` object that is passed into each endpoint. Allowing you to have access to it.
***If you are using sql or mongo, we recommend that you use Prisma.***

```json
"sql": false,
```

#### Server Provider

Wappi has built in functions for Amazon Web Services (AWS)
**Auth Key Secrets**: Wappi has a built in function to read a secret that is stored in your AWS Secrets Manager. See *Security - Auth Keys* for more details.

```json
"serverProvider": "AWS",
```

#### Full Example

```json
{
  "apiKey": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4687121gj2hg3hj12g",
  "authRotation": "*/30 * * * *",
  "deployment": "scalingAwsEC2",
  "domains": "mydomain.com, mydomain.org, www.mydomain.com, www.mydomain.org",
  "port": 3030,
  "prisma": false,
  "private": false,
  "repository": "gitlab",
  "routing": "default",
  "serviceDescription": "API for my awesome App",
  "serviceName": "API",
  "sql": false,
  "serverProvider": "AWS"
}
```

URL: https://www.wappi.dev/configuration
