> For the complete documentation index, see [llms.txt](https://international.open.gov.sg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://international.open.gov.sg/self-hosting/askgov/configuration-reference.md).

# Configuration Reference

AskGov uses environment variables for configuration, making it easy to deploy across different environments without code changes. This reference documents those configuration options.

{% hint style="warning" %}
**Security Note**: Never commit `.env` files containing secrets to version control. Use secure secret management systems in production.
{% endhint %}

### Configuration Categories

1. Core Application
2. Database
3. Authentication & Security
4. Email Service
5. Search Engine (Weaviate)
6. Monitoring & Analytics
7. Feature Flags (using Growthbook)
8. Third-party Services

### Core Application

#### Basic Settings

| Variable         | Required | Default                 | Description                                         |
| ---------------- | -------- | ----------------------- | --------------------------------------------------- |
| `NODE_ENV`       | Yes      | `development`           | Environment: `development`, `staging`, `production` |
| `PORT`           | No       | `8080`                  | Port for the application server                     |
| `FRONTEND_URL`   | Yes      | `http://localhost:8080` | Public URL of your AskGov instance                  |
| `SESSION_SECRET` | Yes      | -                       | Secret key for session encryption (min 32 chars)    |

#### Example Configuration

```bash
NODE_ENV=production
PORT=8080
FRONTEND_URL=https://ask.yourgov.com
SESSION_SECRET=your-very-long-random-session-secret-key-here-minimum-32-characters
```

#### Application Behavior

| Variable           | Required | Default | Description                          |
| ------------------ | -------- | ------- | ------------------------------------ |
| `SOME_CONFIG_HERE` | Yes/No   | `100`   | Example: Maximum requests per window |

### Database

#### CockroachDB Configuration

| Variable       | Required | Default | Description                  |
| -------------- | -------- | ------- | ---------------------------- |
| `DATABASE_URL` | Yes      | -       | PostgreSQL connection string |

#### Connection String Format

```bash
# Standard PostgreSQL format
DATABASE_URL=postgresql://username:password@host:port/database?sslmode=require

# CockroachDB cluster example
DATABASE_URL=postgresql://user:pass@cluster.region.cockroachlabs.cloud:26257/askgov?sslmode=require

# Local development
DATABASE_URL=postgresql://root@localhost:26257/askgov?sslmode=disable
```

### Authentication & Security

#### OTP Configuration

| Variable     | Required | Default | Description                     |
| ------------ | -------- | ------- | ------------------------------- |
| `OTP_SECRET` | Yes      |         | Secreet used for generating OTP |

#### CAPTCHA

| Variable               | Required   | Default | Description          |
| ---------------------- | ---------- | ------- | -------------------- |
| `RECAPTCHA_SITE_KEY`   | If enabled | -       | reCAPTCHA site key   |
| `RECAPTCHA_SECRET_KEY` | If enabled | -       | reCAPTCHA secret key |

### Email Service

#### SMTP Configuration

#### PostmanGovSG Configuration

| Variable               | Required   | Default        | Description          |
| ---------------------- | ---------- | -------------- | -------------------- |
| `POSTMANGOVSG_API_KEY` | If Postman | -              | PostmanGovSG API key |
| `POSTMANGOVSG_API_URL` | No         | Production URL | API endpoint         |

### Search Engine (Weaviate)

#### Weaviate Connection

| Variable                | Required   | Default | Description                |
| ----------------------- | ---------- | ------- | -------------------------- |
| `WEAVIATE_INSTANCE`     | If enabled | -       | Weaviate instance URL      |
| `WEAVIATE_API_KEY`      | If enabled | -       | Weaviate API key           |
| `WEAVIATE_COHERE_CLASS` | If enabled | -       | Cohere class for embedding |

#### Vectorization Configuration

| Variable             | Required | Default | Description            |
| -------------------- | -------- | ------- | ---------------------- |
| `VECTORIZER_API_KEY` | No       | -       | API key for vectorizer |

### Monitoring & Analytics

#### Application Monitoring

| Variable               | Required   | Default | Description          |
| ---------------------- | ---------- | ------- | -------------------- |
| `DATADOG_CLIENT_TOKEN` | If enabled | -       | Datadog client token |

#### Logging

| Variable    | Required | Default | Description                             |
| ----------- | -------- | ------- | --------------------------------------- |
| `LOG_LEVEL` | No       | `info`  | Level: `debug`, `info`, `warn`, `error` |

#### Redis Cache

| Variable    | Required | Default | Description          |
| ----------- | -------- | ------- | -------------------- |
| `REDIS_URL` | Yes      | -       | Redis connection URL |

### Feature Flags

Feature flag is managed by growthbook.

| Variable                | Required | Default | Description    |
| ----------------------- | -------- | ------- | -------------- |
| `GROWTHBOOK_CLIENT_KEY` | Yes      | -       | Client SDK key |

### Environment-Specific Configurations

#### Development Environment

```bash
# .env.development
<put example here>
```

***

{% hint style="success" %}
**Next Steps**

* For deployment: See AWS Production Guide
* For customization: Check Component Customization
* For security: Review Security Guide
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://international.open.gov.sg/self-hosting/askgov/configuration-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
