# ⚙️ Configuration

VortexFileSync is designed to synchronize plugin configurations and data across multiple Minecraft servers using a central database. This guide covers how to set up the plugin, handle multiple servers, and use advanced features like YAML overrides.

***

#### ⚠️ Prerequisites & Requirements <a href="#user-content-prerequisites-requirements" id="user-content-prerequisites-requirements"></a>

**Database Requirement:** VortexFileSync **REQUIRES** a central **MySQL** or **MariaDB** database to function. It uses this database as a "cloud storage" for your files.

**Important Database Note:** Because files (like JARs or large YMLs) are stored as BLOBs, you must ensure your SQL server can handle large packets.

* **Action:** Increase the `max_allowed_packet` in your `my.cnf` or `my.ini` file to at least `64M` or `128M` (depending on your file sizes).

  ```
  SET GLOBAL max_allowed_packet = 67108864;
  ```

{% hint style="warning" %}
**Important**: This plugin is **not** designed for synchronizing live server world data or player database files (e.g., `.db`, `.h2.db`) in multi-server setups. It is intended specifically for configuration files and static assets.
{% endhint %}

***

#### 🗺️ Core Concept: Upload vs. Download <a href="#user-content-core-concept-upload-vs-download" id="user-content-core-concept-upload-vs-download"></a>

* **Upload (The Source):** This server is the "owner" of the files. When files change here, they are pushed to the database.
* **Download (The Client):** This server watches the database for changes. If it sees a newer version, it pulls the files and overwrites its local copy.

***

#### 📂 Using Multiple Servers (Setup Example) <a href="#user-content--using-multiple-servers-setup-example" id="user-content--using-multiple-servers-setup-example"></a>

Imagine you have a **Hub** server and two **Survival** servers. You want to sync a specialized "Menu" plugin config from the Hub to both Survivals.

**🏁 Server 1: The "Source" (Hub)**

On this server, you define the folder in the&#x20;

Upload section.

```yml
Upload:
  CustomMenus:
    Path: plugins/DeluxeMenus/gui_menus
    Ignored Files:
      - "temp/*"
    Upload Trigger Commands:
      - "dm reload" # When you reload the menus, vfs uploads the changes
```

**🏁 Server 2 & 3: The "Clients" (Survival 1 & 2)**

On these servers, you define the folder in the&#x20;

Download section.

```yml
Download:
  CustomMenus:
    Path: plugins/DeluxeMenus/gui_menus
    Commands On Download:
      - "dm reload" # Automatically reloads the menus when new files arrive
```

***

#### 🔄 Advanced: YAML Overrides <a href="#user-content--advanced-yaml-overrides" id="user-content--advanced-yaml-overrides"></a>

Sometimes you want to sync a configuration file but need specific lines to be different on the receiving server (e.g., different server names or database credentials).

**Format Syntax:**

* Use `:` (colon) instead of `.` (dot) for both file extensions and key nesting.
* Wrap keys in `'` (apostrophes) to prevent YAML parsing errors.

**Example: Syncing a Scoreboard with local Server Names**

```yml
Download:
  ScoreboardSync:
    Path: plugins/FeatherBoard
    Yaml Overrides:
      "config:yml": # Targets plugins/FeatherBoard/config.yml
        'settings:server-name': "&bSurvival-01"
        'mysql:database': "survival_db"
```

***

#### 🛡️ File Filtering (Ignored Files) <a href="#user-content-file-filtering-ignored-files" id="user-content-file-filtering-ignored-files"></a>

You can prevent specific files from being synced. This is useful for logs, local databases, or files that contain unique server IDs.

```yml
Upload:
  ExamplePlugin:
    Path: plugins/ExamplePlugin
    Ignored Files:
      - "logs/*"            # Ignore all logs
      - "data/player.db"   # Ignore local player data
      - "*.json"           # Ignore all JSON files
```

***

#### ⏱️ Synchronization Interval <a href="#user-content-synchronization-interval" id="user-content-synchronization-interval"></a>

The `Sync Interval` setting determines how often "Download" servers check the database for updates.

* **Default:** `5` seconds.
* **Low values (1-2):** Near-instant updates, but higher database load.
* **High values (30+):** Efficient, but changes take longer to propagate.

```yaml
Sync Interval: 5
```


---

# Agent Instructions: 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:

```
GET https://wiki.vortexdevelopment.net/projects/vortexfilesync/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
