> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revoscripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Configure Revo Backup settings to match your server's needs.

<Info>
  All configuration options are located in the `config.lua` file within the script folder.
</Info>

## Commands & Key Mappings

### Commands

```lua theme={null}
Config.Commands = {
    openUI = 'backup',           -- /backup, /makebackup, /deletebackup
    makeBackup = 'makebackup',
    deleteBackup = 'deletebackup'
}
```

**Available Commands:**

* `/backup` - Open the backup UI (client-side)
* `/makebackup` - Create a manual backup (opens UI)
* `/deletebackup` - Delete a backup (opens UI)

### Key Mappings

```lua theme={null}
Config.KeyMappings = {
    openUI = 'F6'               -- F6 to open backup UI
}
```

**Default Key:** `F6` - Opens the backup interface

## Backup Settings

### Automatic Backups

#### Enable Auto Backups

```lua theme={null}
Config.AutoBackupEnabled = true -- Enable auto backups (true/false)
```

**Options:**

* `true` - Automatic backups enabled
* `false` - Manual backups only

#### Backup Time

```lua theme={null}
Config.AutoBackupTime = '12:00 AM' -- Backup time: '2:30 PM', '11:45 PM'
```

**Format:** 12-hour format with AM/PM\
**Examples:** `'2:30 PM'`, `'11:45 PM'`, `'12:00 AM'`

#### Backup Interval

```lua theme={null}
Config.AutoBackupInterval = 1 -- Days between backups: 1=daily, 7=weekly
```

**Options:**

* `1` - Daily backups
* `7` - Weekly backups
* `30` - Monthly backups

### Cleanup Settings

#### Auto Cleanup

```lua theme={null}
Config.AutoCleanupEnabled = true -- Automatic cleanup toggle (true/false)
```

**Options:**

* `true` - Old backups automatically deleted
* `false` - Manual cleanup required

#### Cleanup Days

```lua theme={null}
Config.AutoCleanupDays = 30 -- Keep backups for X days: 7, 30, 90
```

**Examples:**

* `7` - Keep backups for 1 week
* `30` - Keep backups for 1 month
* `90` - Keep backups for 3 months

#### Max Backups

```lua theme={null}
Config.MaxBackups = 30 -- Max backups to keep: 10, 50, 100
```

**Purpose:** Prevents unlimited backup accumulation\
**Behavior:** Oldest backups deleted when limit reached

## Database Settings

### Fallback Database Configuration

<Warning>
  These settings are fallback options. The script prefers your server's `mysql_connection_string` from `server.cfg`.
</Warning>

```lua theme={null}
Config.Database = {
    host = 'localhost',        -- Database host
    user = '',                 -- Database username
    password = '',             -- Database password
    database = '',             -- Database name
    charset = 'utf8mb4'        -- Character set
}
```

<Note>
  Only configure these if your server doesn't use `mysql_connection_string` in `server.cfg`.
</Note>

## Permissions

### Admin Groups

```lua theme={null}
Config.AdminGroups = { -- Groups that can manage backups
    'admin',
    'superadmin',
    'owner'
}
```

**Purpose:** Defines which player groups can access backup features

**Supported Frameworks:**

* **ESX:** Uses `Player.getGroup()`
* **QBCore:** Uses `Player.PlayerData.gang.name` and `Player.PlayerData.job.name`
* **vRP:** Uses `vRP.getUserGroup()`
* **Custom:** Add your framework's group checking logic

<Tip>
  Add or remove group names based on your server's permission system. Players in these groups can create, delete, and restore backups.
</Tip>

## Configuration Examples

### Daily Backups at Midnight

```lua theme={null}
Config.AutoBackupEnabled = true
Config.AutoBackupTime = '12:00 AM'
Config.AutoBackupInterval = 1
Config.AutoCleanupEnabled = true
Config.AutoCleanupDays = 7
Config.MaxBackups = 10
```

### Weekly Backups with Monthly Retention

```lua theme={null}
Config.AutoBackupEnabled = true
Config.AutoBackupTime = '2:00 AM'
Config.AutoBackupInterval = 7
Config.AutoCleanupEnabled = true
Config.AutoCleanupDays = 30
Config.MaxBackups = 5
```

### Manual Backups Only

```lua theme={null}
Config.AutoBackupEnabled = false
Config.AutoCleanupEnabled = false
Config.MaxBackups = 50
```

## Backup Storage

Backups are automatically stored in the script folder as `.sql` files:

```
/resources/revo_backup/
├── backup_2024-01-15_12-00-00.sql
├── backup_2024-01-16_12-00-00.sql
└── backup_2024-01-17_12-00-00.sql
```

<Info>
  Backup files are named with timestamps for easy identification and sorting.
</Info>
