> For the complete documentation index, see [llms.txt](https://vitrina-blogerov.gitbook.io/bloggers-showcase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vitrina-blogerov.gitbook.io/bloggers-showcase/product-docs/product-docs-en/architecture/environment-variables.md).

# Environment variables

Environment variables store the base configuration of the language version: domain, language, publishing path, database connection, secrets, and the Telegram bot token.

{% hint style="warning" %}
File `.env` contains secrets. It must not be published, sent in chat, added to a public repository, or attached to tickets without sanitization.
{% endhint %}

### Where it is located `.env`

Each language version has its own file:

```
/opt/bloggers_platform/apps/ru/.env
/opt/bloggers_platform/apps/en/.env
/opt/bloggers_platform/apps/zh/.env
/opt/bloggers_platform/apps/ar/.env
```

### Main variables

| Variable             | Purpose                                                 |
| -------------------- | ------------------------------------------------------- |
| `DOMAIN`             | Platform domain.                                        |
| `APP_LANGUAGE`       | Language version code.                                  |
| `PROJECT_NAME`       | Docker Compose project name.                            |
| `PUBLIC_BASE_PATH`   | Public path of the version, for example `/bloggers/ru`. |
| `DATABASE_URL`       | Connection of the backend and bot to PostgreSQL.        |
| `SECRET_KEY`         | JWT secret.                                             |
| `TELEGRAM_BOT_TOKEN` | Telegram bot token.                                     |
| `DB_USER`            | PostgreSQL user.                                        |
| `DB_PASSWORD`        | PostgreSQL password.                                    |
| `DB_NAME`            | Database name.                                          |

### How variables are used

```mermaid
flowchart TB
    ENV[".env"] --> Backend["backend"]
    ENV --> Bot["bot"]
    ENV --> DB["db"]
    Backend --> A["JWT, API, mini app URL"]
    Bot --> B["Telegram token, public URL"]
    DB --> C["PostgreSQL user/password/db"]
```

### What can be changed through the admin panel

{% tabs %}
{% tab title="Telegram bot token" %}
The token can be changed through the web admin panel. Before saving, the backend checks that Telegram accepts the new token and can configure the mini app button.
{% endtab %}

{% tab title="JWT lifetime" %}
The admin session lifetime can be changed through settings.
{% endtab %}

{% tab title="Channel ID" %}
The Telegram channel ID is set for publishing to the channel.
{% endtab %}
{% endtabs %}

### What is better not to change manually

<details>

<summary>`DATABASE_URL`, `DB_USER`, `DB_PASSWORD`, `DB_NAME`</summary>

These values are tied to the PostgreSQL container. An error in them will prevent the backend and bot from connecting to the database.

</details>

<details>

<summary>`SECRET_KEY`</summary>

This key is used for the admin panel JWT tokens. If the key is changed, old sessions will become invalid.

</details>

<details>

<summary>`PUBLIC_BASE_PATH`</summary>

This path must match the Caddy route and the mini app URL. If you change it manually, you can break links, assets, and the Telegram button.

</details>

### Example

```env
DOMAIN=example.com
APP_LANGUAGE=ru
PROJECT_NAME=bloggers_ru
PUBLIC_BASE_PATH=/bloggers/ru
DEBUG=False
ENABLE_DOCS=False
DATABASE_URL=postgresql+asyncpg://blogger_admin:password@db:5432/bloggers_db
SECRET_KEY=random_secret
TELEGRAM_BOT_TOKEN=123456:ABCDEF
BOT_PROXY=
DB_USER=blogger_admin
DB_PASSWORD=password
DB_NAME=bloggers_db
```

{% hint style="info" %}
After changing `.env` manually, restarting the services of the corresponding language version is usually required.
{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://vitrina-blogerov.gitbook.io/bloggers-showcase/product-docs/product-docs-en/architecture/environment-variables.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
