Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,40 @@ docker run -d \

<br />

Environment Variables
==================

Requestrr supports the following environment variables to help you customize your deployment:

#### `REQUESTRR_PORT`

* **Description**: Sets the port the application listens on **inside** the container.
* **Default**: `4545`
* **Example**: `-e REQUESTRR_PORT=5000`

#### `REQUESTRR_BASEURL`

* **Description**: Defines a base URL path for Requestrr. Useful when deploying behind a reverse proxy with a subpath (e.g. `/requestrr`).
* **Default**: `/`
* **Example**: `-e REQUESTRR_BASEURL=/requestrr`

#### Example Docker Command with Environment Variables

```bash
docker run -d \
--name requestrr \
-p 5000:5000 \
-v /opt/Requestrr/config:/root/config \
-e REQUESTRR_PORT=5000 \
-e REQUESTRR_BASEURL=/requestrr \
--restart=unless-stopped \
thomst08/requestrr
```

> ⚠️ **Note**: When setting `REQUESTRR_BASEURL`, make sure it matches your reverse proxy config if you're serving Requestrr under a subpath.

<br />

Build Instructions
==================

Expand Down
19 changes: 16 additions & 3 deletions Requestrr.WebApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ public class Program

public static void Main(string[] args)
{
string cliBaseUrl = null;
string cliBaseUrl = Environment.GetEnvironmentVariable("REQUESTRR_BASE_URL");
int cliPort = -1;

if (int.TryParse(Environment.GetEnvironmentVariable("REQUESTRR_PORT"), out int portFromEnv))
{
cliPort = portFromEnv;
}

for (int i = 0; i < args.Length; i++)
{
switch (args[i])
Expand Down Expand Up @@ -136,9 +141,17 @@ public static void Main(string[] args)
});
}

if (cliBaseUrl != null && cliBaseUrl != SettingsFile.Read().BaseUrl)
if (!string.IsNullOrEmpty(cliBaseUrl) && cliBaseUrl != (string)SettingsFile.Read().BaseUrl)
{
Console.WriteLine("Changing base url from cli arguments...");
if (cliBaseUrl == "/")
cliBaseUrl = string.Empty;
else if (cliBaseUrl.EndsWith("/"))
{
Console.WriteLine("Error: Base URL cannot end in a slash '/'");
return;
}

Console.WriteLine("Changing base url from environment or CLI arguments...");
SettingsFile.Write(settings =>
{
settings.BaseUrl = cliBaseUrl;
Expand Down