# Server Config

This section documents all fields, purposes, allowed values, defaults, and fallback rules for server config `config-server.dc`.

For `dc` format conventions, please read:
- [Getting Started](../Client/Getting_Started)

## Location
- Directory: `config/dlc_manager/`
- File: `config-server.dc`

> Note: This file is server-side only.

## Complete Example
```dc
[server]
serverSupport = true
serverPort = 29690
serverPassword = ""
modpackUrl = ""
updateGithubRepo = ""
rconHost = "127.0.0.1"
rconPort = 25575
rconPassword = ""

[ui]
isEnableAllButtonShown = true
isUpdateManagerOn = true
isSelfUpdateAutoCheckOn = true
isPresetFuncOn = true
WaitingTime = 0

[paths]
dlcRoot = "DLC"
taczRoot = "tacz"
resourcepackRoot = "resourcepacks"
datapackRoot = "datapacks"

[downloads]
maxConcurrentDownloads = 5
maxSegmentsPerFile = 4
minSegmentMB = 20
maxRetryCount = 5
connectTimeoutSeconds = 10
taskTimeoutSeconds = 60
```

---

## Field Reference

### `[server]`
#### `serverSupport`
- **Purpose**: Enable server-side DLC Manager communication.
- **Allowed**: Boolean.
- **Default**: `true`.

#### `serverPort`
- **Purpose**: Server DLC Manager communication port.
- **Allowed**: Integer, range `1~65535`.
- **Default**: `29690`.
- **Fallback**: Out-of-range values fall back to default.

#### `serverPassword`
- **Purpose**: Server DLC Manager password (plain text).
- **Allowed**: String.
- **Default**: Empty string (no password).

#### `modpackUrl`
- **Purpose**: Modpack homepage link exposed to manager UI.
- **Allowed**: String URL.
- **Default**: Empty.

#### `updateGithubRepo`
- **Purpose**: Pack release update repository URL(s).
- **Allowed**:
  - Single repository URL
  - Multiple repository URLs separated by commas (fallback in order)
  - HTTPS/HTTP repository page URL, release page URL, or SSH form (`git@host:owner/repo.git`)
- **Supported providers**:
  - GitHub
  - GitLab (including self-hosted instances)
  - Gitee
  - Generic Git hosts with API fallback probing
- **Default**: Empty.

#### `rconHost`
- **Purpose**: RCON host (used by the server manager’s RCON features).
- **Allowed**: String.
- **Default**: Empty string.
- **Optional**: If not set, the client connection page can supply it.

#### `rconPort`
- **Purpose**: RCON port.
- **Allowed**: Integer, range `1~65535`.
- **Default**: `25575`.
- **Fallback**: Out-of-range values fall back to default.

#### `rconPassword`
- **Purpose**: RCON password (plain text).
- **Allowed**: String.
- **Default**: Empty string.

> **Tip**: If `rconHost/rconPort/rconPassword` keep their defaults, the config file may omit them.

---

### `[ui]` (server manager UI toggles)
> These options are returned by the server and control what the client-side “Server Manager” UI shows.

#### `isEnableAllButtonShown`
- **Purpose**: Show “Enable All / Disable All”.
- **Allowed**: Boolean.
- **Default**: `true`.

#### `isUpdateManagerOn`
- **Purpose**: Enable the server update manager.
- **Allowed**: Boolean.
- **Default**: `true`.

#### `isSelfUpdateAutoCheckOn`
- **Purpose**: Allow auto-check for DLC Manager updates.
- **Allowed**: Boolean.
- **Default**: `true`.

#### `isPresetFuncOn`
- **Purpose**: Enable presets.
- **Allowed**: Boolean.
- **Default**: `true`.

#### `WaitingTime`
- **Purpose**: Alarm screen wait time before confirmation.
- **Allowed**: Integer `0~10`.
- **Default**: `0`.

---

### `[paths]`
> All paths are resolved relative to the **server modpack root**.

#### `dlcRoot`
- **Purpose**: DLC root directory.
- **Allowed**: String (relative or absolute).
- **Default**: `"DLC"`.

#### `taczRoot`
- **Purpose**: TACZ root directory.
- **Allowed**: String (relative or absolute).
- **Default**: `"tacz"`.

#### `resourcepackRoot`
- **Purpose**: Resource pack directory.
- **Allowed**: String (relative or absolute).
- **Default**: `"resourcepacks"`.

#### `datapackRoot`
- **Purpose**: Data pack directory.
- **Allowed**: String (relative or absolute).
- **Default**: `"datapacks"`.

---

### `[downloads]`
#### `maxConcurrentDownloads`
- **Purpose**: Maximum concurrent download tasks.
- **Allowed**: Integer.
- **Default**: `5`.

#### `maxSegmentsPerFile`
- **Purpose**: Maximum segments per file.
- **Allowed**: Integer.
- **Default**: `4`.

#### `minSegmentMB`
- **Purpose**: Minimum segment size (MB).
- **Allowed**: Integer.
- **Default**: `20`.

#### `maxRetryCount`
- **Purpose**: Maximum retry count per segment.
- **Allowed**: Integer.
- **Default**: `5`.

#### `connectTimeoutSeconds`
- **Purpose**: Connection timeout (seconds).
- **Allowed**: Integer.
- **Default**: `10`.

#### `taskTimeoutSeconds`
- **Purpose**: Task timeout (seconds).
- **Allowed**: Integer.
- **Default**: `60`.

---

## Notes
- Keys are case-insensitive.
- Unspecified fields fall back to defaults.
- After changing `serverPort`, clients must use the same port when connecting to the server manager.
