From aa4cf5ff588c9082282ee57074199dc7d2a37e09 Mon Sep 17 00:00:00 2001
From: Bobby <30593201+luciferreeves@users.noreply.github.com>
Date: Wed, 25 Feb 2026 13:30:13 +0530
Subject: chore: Update .env.example and README for environment variable
configuration
---
.env.example | 10 +++++++---
README.md | 56 ++++++++++++++++++++++++++++++++++----------------------
2 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/.env.example b/.env.example
index c401cdc..0f432b3 100644
--- a/.env.example
+++ b/.env.example
@@ -1,5 +1,9 @@
-DB_DRIVER=sqlite # sqlite, mysql, postgres, sqlserver (case sensitive)
-DSN=metachan.db
+HOST=0.0.0.0
PORT=3000
+DEBUG=false
+DB_DRIVER=sqlite
+DSN=metachan.db
+ANISYNC=false
TMDB_API_KEY=
-TMDB_READ_ACCESS_TOKEN=
\ No newline at end of file
+TMDB_READ_ACCESS_TOKEN=
+TVDB_API_KEY=
\ No newline at end of file
diff --git a/README.md b/README.md
index 7c27631..6dbd8f8 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-> [!CAUTION]
+> [!CAUTION]
> I _do not_ provide pre-hosted instances of the MetaChan API. You will need to host your own instance of the API to use it. MetaChan is provided on an "as-is" basis and fetches data from various public sources and projects, some of which may have rate limits, restrictions, and even contain pirated content. The API is intended for personal use only and should not be used for commercial purposes. I do not take any responsibility for any legal issues that may arise from using the API. Please use it at your own risk. I _do not_ condone piracy or illegal distribution of content.
# MetaChan
@@ -12,15 +12,7 @@ Welcome to **MetaChan**. MetaChan is an Anime and Manga metadata API that provid
-## Deployment Options
-
-You can deploy this API using either a [Docker](https://www.docker.com) container or by running it directly with [Go](https://go.dev). The API supports multiple database systems including [SQLite](https://www.sqlite.org/index.html), [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/), and [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-downloads).
-
-Database configuration is handled through environment variables[See: [Configuring Environment Variables](#configuring-environment-variables)].
-
-## Local Development
-
-### Prerequisites
+## Prerequisites
- [Go](https://go.dev) 1.24.1 or later
- [Make](https://www.gnu.org/software/make/)
@@ -34,17 +26,36 @@ If you wish to use Docker, you will also need to install [Docker](https://www.do
You might also need to install [Git](https://git-scm.com/) if you want to clone the repository.
-### Configuring Environment Variables
+## Configuring Environment Variables
You can configure the environment variables by creating a `.env` file in the root directory of the project. The example `.env` file contains all the available environment variables and their default values. You can modify these values to suit your needs.
+
The following environment variables are available:
+
| Variable Name | Description | Default Value |
-| -------------- | ----------- | ------------- |
-| `DB_DRIVER` | The database driver to use. Supported drivers are `sqlite`, `postgres`, `mysql`, and `sqlserver`. The options are **case-sensitive**. | `sqlite` |
-| `DSN` | The Data Source Name (DSN) for the database connection. This is used to connect to the database. The format of the DSN depends on the database driver you are using. Following are the DSN formats for each driver:
• **_sqlite_**: `metachan.db` or `/path/to/metachan.db`
• **_postgres_**: `host=localhost port=5432 user=postgres password=postgres dbname=metachan sslmode=disable`
• **_mysql_**: `root:password@tcp(localhost:3306)/metachan`
• **_sqlserver_**: `sqlserver://localhost:1433?database=metachan` | `metachan.db` |
+| --- | --- | --- |
+| `HOST` | The host address to bind the server to. | `0.0.0.0` |
| `PORT` | The port to run the API on. | `3000` |
+| `DEBUG` | Enable debug logging. | `false` |
+| `DB_DRIVER` | The database driver to use. Supported drivers are `sqlite`, `postgres`, `mysql`, and `sqlserver`. The options are **case-sensitive**. | `sqlite` |
+| `DSN` | The Data Source Name (DSN) for the database connection. The format depends on the database driver you are using. See [Configuring Data Source Names (DSN)](#configuring-data-source-names-dsn) below. | `metachan.db` |
+| `ANISYNC` | Enable background anime sync task. | `false` |
+| `TMDB_API_KEY` | API key for [TMDB](https://www.themoviedb.org/) episode enrichment. | |
+| `TMDB_READ_ACCESS_TOKEN` | Read access token for TMDB API v4. | |
+| `TVDB_API_KEY` | API key for [TVDB](https://thetvdb.com/) episode enrichment. | |
+
+### Configuring Data Source Names (DSN)
+
+The DSN format varies depending on which database driver you are using. Refer to the table below for the correct format for each driver.
-### Starting Development Server
+| Driver | DSN Format |
+| --- | --- |
+| `sqlite` | `metachan.db` or `/path/to/metachan.db` |
+| `postgres` | `host=localhost port=5432 user=postgres password=postgres dbname=metachan sslmode=disable` |
+| `mysql` | `root:password@tcp(localhost:3306)/metachan` |
+| `sqlserver` | `sqlserver://localhost:1433?database=metachan` |
+
+## Local Development
After you have installed the prerequisites, [forked](https://github.com/luciferreeves/metachan/fork) the repository and cloned it to your local machine, start by installing the dependencies:
@@ -60,12 +71,13 @@ Now you can start the development server by running:
make dev
```
-### Building for Production
+## Building for Production
> [!WARNING]
> The API is still under **heavy development** and the `main` branch contains breaking changes. A lot of features are still missing and the Documentation is not complete. There are _no releases_ yet. If you still want to use the API, you can build it from the source code or use the [Dockerfile](Dockerfile) to build a Docker image. The API is not production ready yet and should be used at your own risk. I am not responsible for any data loss or damage caused by using the API.
-Building for production use is easy. To build for production, run the following commands:
+To build for production, run the following commands:
+
```bash
make build
make run
@@ -73,23 +85,23 @@ make run
This will build the binary and run it. The API will be available at `http://localhost:3000` by default.
-### Docker
+## Docker
-You can also run the API using Docker. The Dockerfile is included in the repository and can be used to build a Docker image for the API. To build the Docker image, run the following command:
+You can also run the API using Docker. To build the Docker image, run the following command:
```bash
docker build -t metachan .
```
-This will build the Docker image with the name `metachan`. You can then run the Docker image using the following command:
+To run the Docker image:
```bash
docker run -p 3000:3000 -e DB_DRIVER=sqlite -e DSN=metachan.db --name metachan metachan
```
-This will run the Docker image and expose the API on port `3000`. You can change the `DB_DRIVER` and `DSN` environment variables to use a different database. The API will be available at `http://localhost:3000` by default.
+This will expose the API on port `3000`. You can change the `DB_DRIVER` and `DSN` environment variables to use a different database.
## API Documentation
> [!NOTE]
-> Documentation for this API is **not complete**. The API is still under heavy development and the endpoints are subject to change. This [README](README.md) file will be updated with the API documentation once it is available.
+> Documentation for this API is **not complete**. The API is still under heavy development and the endpoints are subject to change. This [README](README.md) file will be updated with the API documentation once it is available.
\ No newline at end of file
--
cgit v1.2.3