Skip to main content

Server Config (Secrets)

server/config.lua — Discord bot, YouTube API key, Fivemanage API keys, Discord webhooks.

This section

Server Config (Secrets)

server/config.lua is server-only — it is never sent to clients and never exposed in any UI. This is where API keys, bot tokens, and webhook URLs live.

It is also escrow-ignored, so server owners can edit it after purchasing.

Full File Layout

lua
ServerConfig = {

-- ╔═══════════════════════════════════════════════════════════════╗
-- ║ DISCORD ROLE PERMISSIONS ║
-- ╚═══════════════════════════════════════════════════════════════╝

DiscordBotToken = "",
DiscordGuildId = "",
DiscordCacheDuration = 120,

-- ╔═══════════════════════════════════════════════════════════════╗
-- ║ YOUTUBE API ║
-- ╚═══════════════════════════════════════════════════════════════╝

YouTubeAPIKey = "",

-- ╔═══════════════════════════════════════════════════════════════╗
-- ║ DASHCAM UPLOAD ║
-- ╚═══════════════════════════════════════════════════════════════╝

DashCamUploadProvider = "fivemanage", -- "fivemanage" or "discord"
DashCamFivemanageApiKey = "",
DashCamDiscordWebhook = "",

-- ╔═══════════════════════════════════════════════════════════════╗
-- ║ SECURITY CAM UPLOAD ║
-- ╚═══════════════════════════════════════════════════════════════╝

SecurityCamUploadProvider = "fivemanage",
SecurityCamFivemanageApiKey = "", -- empty = inherits dashcam key
SecurityCamDiscordWebhook = "", -- empty = inherits dashcam webhook
}

Discord Bot

Used to fetch player Discord roles for permission gating.

FieldTypeDescription
DiscordBotTokenstringBot token from Discord Developer Portal
DiscordGuildIdstringServer (guild) ID — copy from Discord with Developer Mode
DiscordCacheDurationnumberHow long to cache role lookups in seconds (default 120)

Setup

  1. discord.com/developers/applicationsNew Application
  2. Add a Bot → copy the Bot Token
  3. Enable Server Members Intent (Privileged Gateway Intents)
  4. Invite the bot to your server with the bot scope and at minimum View Server Members permission
  5. In Discord with Developer Mode enabled, right-click your server → Copy Server ID

When Empty

If either DiscordBotToken or DiscordGuildId is empty, all discordRoles checks are silently skipped. Job-based permissions still work without Discord.

Cache Tuning

  • 120 (default) — good for most servers
  • 300-600 — for servers where roles rarely change, reduces API calls
  • 30 — for fast role-change propagation
  • 0 — disables caching entirely (one API call per check, not recommended)

YouTube API Key

Required for music search.

FieldTypeDescription
YouTubeAPIKeystringYouTube Data API v3 key from Google Cloud Console

Setup

  1. console.cloud.google.com → create project (or use existing)
  2. Enable YouTube Data API v3
  3. Create credentials → API key
  4. (Recommended) restrict the key to YouTube Data API v3 + IP allowlist

Quota

The free tier is 10,000 units/day. Each search call costs ~100 units. A single key easily covers a busy server (~100 searches/day per player at 10 players).

If you hit quota limits, create a second project and rotate keys, or apply for a higher quota.

When Empty

Music search does not work. Liked songs and pre-saved playlists with already-fetched titles still play correctly — only the search box returns empty.


DashCam Upload

FieldTypeDescription
DashCamUploadProviderstring"fivemanage" or "discord"
DashCamFivemanageApiKeystringAPI key from fivemanage.com
DashCamDiscordWebhookstringWebhook URL from a Discord channel

Provider Comparison

ProviderFile limitSetup
FivemanageUnlimitedAPI key — paid service with free tier
Discord25 MBWebhook URL — completely free

Discord's 25 MB hard limit means you can only upload ~1.5 minutes at typical bitrate. For full 5-minute recordings, use Fivemanage.

Fivemanage Setup

  1. Sign up at fivemanage.com
  2. Dashboard → API KeysCreate
  3. Set the permission to allow video uploads
  4. Copy the key

Discord Webhook Setup

  1. In your Discord server, create a channel for recordings
  2. Channel settings → Integrations → Webhooks → New WebhookCopy Webhook URL
  3. (Optional) customize the webhook avatar / name

Security Camera Upload

Independent settings — security cam recordings can go to a different destination than dashcam recordings.

FieldTypeDescription
SecurityCamUploadProviderstring"fivemanage" or "discord"
SecurityCamFivemanageApiKeystringEmpty → inherits DashCamFivemanageApiKey
SecurityCamDiscordWebhookstringEmpty → inherits DashCamDiscordWebhook

Common patterns:

  • One destination for everything → leave both Security fields empty, set DashCam credentials, both feed the same destination
  • Dashcam to Discord, Security cam to Fivemanage → set Discord webhook on DashCam fields, set Fivemanage key on Security fields
  • Two separate Discord channels → set both DashCamDiscordWebhook and SecurityCamDiscordWebhook to different webhook URLs

Adding Custom Secrets

server/config.lua is your space — add your own keys for custom server-side modules:

lua
ServerConfig.MySecretApiKey = "..."
ServerConfig.MyWebhook = "..."

Reference them from server-side Lua: ServerConfig.MySecretApiKey. Never reference from client-side code.