Skip to main content
Mythic Framework uses FiveM convars to control server behavior. The two key convars that affect environment behavior are sv_environment and log_level.

Setting the Environment

# server.cfg
set sv_environment "prod"
Valid Values:
  • dev — Development mode (verbose logging, relaxed security)
  • prod — Production mode (optimized performance, minimal logging)
Important: Always set this to "prod" before launching your live server. Development mode has performance impacts and verbose logging.

Environment Behavior

Development (dev)

  • Verbose console logging
  • Detailed error messages
  • Relaxed security checks
  • Useful for debugging

Production (prod)

  • Minimal logging (errors only)
  • Optimized performance
  • Full security features active
  • Anti-cheat enabled

Log Level

The log_level convar controls logging verbosity. It uses a numeric value:
# server.cfg
setr log_level 0
ValueDescriptionUse Case
0Minimal loggingProduction
1Basic loggingLight debugging
2Verbose loggingActive debugging
3+Very verboseDeep debugging
Higher values produce more verbose output. Use 0 in production, increase when troubleshooting issues.

All Framework Convars

Here is a complete reference of convars used by Mythic Framework:

Core Settings

ConvarTypeDefaultDescription
sv_environmentset"prod"Environment mode (dev or prod)
log_levelsetr0Logging verbosity (numeric, 0 = minimal)
sv_access_roleset0Access role level
mfw_versionsetr"1.0.0"Framework version identifier
discord_appsetrDiscord application ID (rich presence)

Database Convars

ConvarTypeDescription
mongodb_auth_urlsetMongoDB Auth DB connection string
mongodb_auth_databasesetMongoDB Auth DB name (typically auth)
mongodb_game_urlsetMongoDB Game DB connection string
mongodb_game_databasesetMongoDB Game DB name (typically fivem)
mysql_connection_stringsetMySQL connection string for oxmysql
mysql_slow_query_warningsetSlow query warning threshold in ms

Discord Webhook Convars

ConvarDescription
discord_admin_webhookAdmin action logging
discord_connection_webhookPlayer connection/disconnection logging
discord_log_webhookGeneral logging
discord_kill_webhookKill/death logging
discord_error_webhookError and crash logging
discord_pwnzor_webhookAnti-cheat detection logging

External Service Convars

ConvarDescription
FIVEMANAGE_MEDIA_API_KEYFiveManage API key for image uploads (gallery, photos)

Network / FiveM Convars

ConvarDescription
sv_hostnameServer name in browser
sv_maxclientsMaximum player count
sv_enforceGameBuildRequired game build version
sv_licenseKeyFiveM license key
steam_webApiKeySteam Web API key
onesyncOneSync mode (must be on)

Reading Convars in Code

Lua (Server or Client)

-- Get the environment
local env = GetConvar('sv_environment', 'prod')

if env == 'dev' then
    print('[DEV] Development mode active')
end

-- Get log level (numeric)
local logLevel = tonumber(GetConvar('log_level', '0')) or 0

-- Get a string convar
local fivemanageKey = GetConvar('FIVEMANAGE_MEDIA_API_KEY', '')

Important: Convar Type Handling

Convars always return strings. Convert as needed:
-- Boolean-like convars: compare strings
local isDev = GetConvar('sv_environment', 'prod') == 'dev'

-- Numeric convars: use tonumber
local logLevel = tonumber(GetConvar('log_level', '0')) or 0

-- With validation
local maxSlots = tonumber(GetConvar('inventory_max_slots', '50')) or 50

Custom Convars

You can define your own convars in server.cfg for resource-specific configuration:
# server.cfg — custom settings
set my_feature_enabled "true"
set my_api_key "your_key_here"
set my_custom_rate "1.5"
-- Read in your resource
local featureEnabled = GetConvar('my_feature_enabled', 'false') == 'true'
local apiKey = GetConvar('my_api_key', '')
local rate = tonumber(GetConvar('my_custom_rate', '1.0')) or 1.0
Use set for convars that should only be readable server-side. Use setr for convars that should also be readable on the client via GetConvar.

Complete server.cfg Reference

# === ENVIRONMENT ===
set sv_environment "prod"
set sv_access_role 0
setr log_level 0
setr mfw_version "1.0.0"
setr discord_app "your_discord_app_id"

# === DATABASE ===
set mongodb_auth_url "mongodb://localhost:27017/?readPreference=primary&ssl=false"
set mongodb_auth_database "auth"
set mongodb_game_url "mongodb://localhost:27017/?readPreference=primary&ssl=false"
set mongodb_game_database "fivem"
set mysql_connection_string "mysql://root@localhost/MythicFramework?charset=utf8mb4"
set mysql_slow_query_warning 300

# === DISCORD WEBHOOKS ===
set discord_admin_webhook ""
set discord_connection_webhook ""
set discord_log_webhook ""
set discord_kill_webhook ""
set discord_error_webhook ""
set discord_pwnzor_webhook ""

# === EXTERNAL SERVICES ===
set FIVEMANAGE_MEDIA_API_KEY "your_fivemanage_key"

# === ONESYNC ===
set onesync on
set onesync_enabled true
set onesync_population true

Troubleshooting

Problem: GetConvar returns empty or default valueSolutions:
  1. Verify the convar is set in server.cfg with set keyword:
    set my_variable "value"
    
  2. Check for typos in the convar name
  3. Ensure server was restarted after changing server.cfg
  4. Always provide a default fallback:
    local value = GetConvar('my_variable', 'default_value')
    
Problem: Boolean check always evaluates to trueCause: GetConvar returns strings, and any non-empty string is truthy in LuaSolution:
-- Wrong: always true (non-empty string)
local debug = GetConvar('sv_environment', 'prod')
if debug then end  -- always enters

-- Correct: compare the string value
local isDev = GetConvar('sv_environment', 'prod') == 'dev'
if isDev then end  -- only enters when actually "dev"
Problem: Math operations fail on convar valuesSolution:
-- Wrong: string, not number
local level = GetConvar('log_level', '0')
local doubled = level * 2  -- error

-- Correct: convert to number
local level = tonumber(GetConvar('log_level', '0')) or 0
local doubled = level * 2  -- works

Next Steps

Server Configuration

Complete server.cfg guide

Database Connections

Configure database connection strings

Discord Webhooks

Set up webhook logging

Resource Management

Resource load order and dependencies