> ## Documentation Index
> Fetch the complete documentation index at: https://activepieces-feat-selfhost-appwebhooks.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

To configure activepieces, you will need to set some environment variables, There is file called `.env` at the root directory for our main repo.

<Tip>
  When you execute the deploy.sh script in the Docker installation tutorial, it
  will produce these values.
</Tip>

## Environment Variables

| Variable                           | Description                                                                                                                                       | Default Value                                          | Example                                                                                                                         |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| `AP_CONFIG_PATH`                   | Optional parameter for specifying the path to store SQLite3 and local settings.                                                                   | `~/.activepieces`                                      |                                                                                                                                 |
| `AP_CLOUD_AUTH_ENABLED`            | Turn off the utilization of Activepieces oauth2 applications                                                                                      | `false`                                                |                                                                                                                                 |
| `AP_DB_TYPE`                       | The type of database to use. (POSTGRES / SQLITE3)                                                                                                 | `SQLITE3`                                              |                                                                                                                                 |
| `AP_EXECUTION_MODE`                | You can choose between 'SANDBOXED' or 'UNSANDBOXED' as possible values. If you decide to change this, make sure to carefully read the next below. | `SANDBOXED`                                            |                                                                                                                                 |
| `AP_ENCRYPTION_KEY`                | ❗️ Encryption key used for connections                                                                                                            | `None`                                                 |                                                                                                                                 |
| `AP_FRONTEND_URL`                  | ❗️ Url that will be used to specify redirect url and webhook url.                                                                                 | `None`                                                 | [https://demo.activepieces.com/api](https://demo.activepieces.com/api)                                                          |
| `AP_JWT_SECRET`                    | ❗️ Encryption key used for generating JWT tokens                                                                                                  | `None`                                                 | [https://demo.activepieces.com](https://demo.activepieces.com)                                                                  |
| `AP_QUEUE_MODE`                    | The queue mode to use. (MEMORY / REDIS)                                                                                                           | `MEMORY`                                               |                                                                                                                                 |
| `AP_QUEUE_UI_ENABLED`              | Enable the queue UI (only works with redis)                                                                                                       | `true`                                                 |                                                                                                                                 |
| `AP_QUEUE_UI_USERNAME`             | The username for the queue UI                                                                                                                     | None                                                   |                                                                                                                                 |
| `AP_QUEUE_UI_PASSWORD`             | The password for the queue UI                                                                                                                     | None                                                   |                                                                                                                                 |
| `AP_TRIGGER_DEFAULT_POLL_INTERVAL` | The default polling internal for app triggers in minutes                                                                                          | `5`                                                    |                                                                                                                                 |
| `AP_PIECES_SOURCE`                 | `AP_PIECES_SOURCE`: `FILE` for local development, `DB` for database, `CLOUD_AND_DB` for both.                                                     | `CLOUD_AND_DB`                                         |                                                                                                                                 |
| `AP_POSTGRES_DATABASE`             | ❗️ The name of the PostgreSQL database                                                                                                            | `None`                                                 |                                                                                                                                 |
| `AP_POSTGRES_HOST`                 | ❗️ The hostname or IP address of the PostgreSQL server                                                                                            | `None`                                                 |                                                                                                                                 |
| `AP_POSTGRES_PASSWORD`             | ❗️ The password for the PostgreSQL user                                                                                                           | `None`                                                 |                                                                                                                                 |
| `AP_POSTGRES_PORT`                 | ❗️ The port number for the PostgreSQL server                                                                                                      | `None`                                                 |                                                                                                                                 |
| `AP_POSTGRES_USERNAME`             | ❗️ The username for the PostgreSQL user                                                                                                           | `None`                                                 |                                                                                                                                 |
| `AP_POSTGRES_USE_SSL`              | Use SSL to connect the postgres database                                                                                                          | `false`                                                |                                                                                                                                 |
| `AP_POSTGRES_SSL_CA`               | Use SSL Certificate to connect to the postgres database                                                                                           | `None`                                                 |                                                                                                                                 |
| `AP_REDIS_URL`                     | If a Redis connection URL is specified, all other Redis properties will be ignored.                                                               | `None`                                                 |                                                                                                                                 |
| `AP_REDIS_USER`                    | ❗️ Username to use when connect to redis                                                                                                          | `None`                                                 |                                                                                                                                 |
| `AP_REDIS_PASSWORD`                | ❗️ Password to use when connect to redis                                                                                                          | `None`                                                 |                                                                                                                                 |
| `AP_REDIS_HOST`                    | ❗️ The hostname or IP address of the Redis server                                                                                                 | `None`                                                 |                                                                                                                                 |
| `AP_REDIS_PORT`                    | ❗️ The port number for the Redis server                                                                                                           | `None`                                                 |                                                                                                                                 |
| `AP_RESIS_DB`                      | The Redis database index to use                                                                                                                   | `0`                                                    |                                                                                                                                 |
| `AP_REDIS_USE_SSL`                 | Connect to Redis with SSL                                                                                                                         | `false`                                                |                                                                                                                                 |
| `AP_NOTIFICATION_URL`              | The notification URL is triggered whenever a run fails.                                                                                           | `false`                                                | [https://cloud.activepieces.com/flows/WEBHOOK\_TRIGGER\_FLOW\_ID](https://cloud.activepieces.com/flows/WEBHOOK_TRIGGER_FLOW_ID) |
| `AP_OPENAI_API_KEY`                | This is required only if you want to enable code copilot                                                                                          | `None`                                                 |                                                                                                                                 |
| `AP_SANDBOX_RUN_TIME_SECONDS`      | Maximium allowed runtime for the flow in seconds                                                                                                  | 600                                                    | 20                                                                                                                              |
| `AP_SIGN_UP_ENABLED`               | Enable the Sign up, It requires sandboxing to be on                                                                                               | `false`                                                |                                                                                                                                 |
| `AP_TELEMETRY_ENABLED`             | Collect telemetry information                                                                                                                     | `true`                                                 |                                                                                                                                 |
| `AP_TEMPLATES_SOURCE_URL`          | This is the endpoint we query for templates, remove it and templates will be removed from UI                                                      | `https://cloud.activepieces.com/api/v1/flow-templates` |                                                                                                                                 |
| `AP_WEBHOOK_TIMEOUT_SECONDS`       | The default timeout for webhooks. This option is not available on cloud because of cloudflare                                                     | `30`                                                   |                                                                                                                                 |

<Warning>
  The frontend URL is essential for webhooks and app triggers to work. It must
  be accessible to third parties to send data.
</Warning>

### Seperate Workers from api

To separate workers from API servers, you can achieve this by setting `AP_FLOW_WORKER_CONCURRENCY` to zero on API servers, while keeping it on worker servers.

### Enabling Sign-Up:

To enable the sign-up feature, you need to ensure the code runs safely on the machine, especially if you don't trust the users. Follow these two steps:

1. Make the Docker container privileged: Edit the `docker-compose.yml` file and add `privileged: true`. This allows the container to have additional permissions to sandbox.
2. Change the execution mode to sandboxing: Modify the `AP_EXECUTION_MODE` setting to `SANDBOXED`. This ensures the code runs within a secure environment, isolated from the rest of the system.
3. Modify the `AP_SIGN_UP_ENABLED` to true , the environment variable.

### Enable Code Generator

To enable the code generator button, please provide a value for the `AP_OPENAI_API_KEY` environment variable.

### Setting Webhook (Frontend URL):

The default URL is set to the machine's IP address. To ensure proper operation, ensure that this address is accessible or specify an `AP_FRONTEND_URL` environment variable.

One possible solution for this is using a service like ngrok ([https://ngrok.com/](https://ngrok.com/)), which can be used to expose the frontend port (4200) to the internet.
