Configuration - c-orter/ModSync GitHub Wiki

Configuration

ModSync aims to be customizable to your needs as a either a server admin or a player joining an SPT server. These sections will help you if you are wanting to sync new files, exclude certain files from syncing, or change the way syncing works. The following sections will break down the configurations you have available to you on both the server and client.

Server

The serverside is really the heart of ModSync configuration, here you can pretty extensively customize your server's syncing behavior. The main place you'll look to configure the server is in user/mods/Corter-ModSync/config.jsonc. The server config has two major sections, syncPaths and exclusions.

syncPaths

The syncPaths section is where you'll configure what files to sync and how they should be synced. Below, you'll find the default syncPath value and a breakdown of what each option does.

{
	"syncPaths": [
		"BepInEx/plugins",
		"BepInEx/patchers",
		"BepInEx/config",
		{
			"enabled": false,
			"name": "(Optional) Server mods",
			"path": "user/mods",
			"restartRequired": false
		}
	],
    // ...
}

Note

There are two hardcoded syncPaths specified in the server mod. They are defined as follows
{
	"enabled": true,
	"enforced": true,
	"silent": true,
	"restartRequired": false,
	"path": "ModSync.Updater.exe",
	"name": "(Builtin) ModSync Updater"
},
{
	"enabled": true,
	"enforced": true,
	"silent": true,
	"restartRequired": true,
	"path": "BepInEx/plugins/Corter-ModSync.dll",
	"name": "(Builtin) ModSync Plugin"
}

Options

If all you want is to add a new path and keep the default sync behavior, you can simply specify the path as a string.

// Adding
{
    "syncPaths": [
        // ...
        "BepInEx/plugins"
    ]
}

For more control over how files are synced, you can specify an object for the path. Any of the following options can be specified to customize behavior, or they can be omitted to inherit the default value.

  • path (string, required) - What path will be synced by this entry
    • Path must be relative to the SPT server root and must be within the SPT server installation.
    • These paths can be to folders, recursively including all children, or individual files.
    • Exclusions can be overridden by more specific syncPaths (ie. An exclusion of BepInEx/plugins/Amands* can be overridden by adding BepInEx/plugins/AmandsGraphics explicitly as a syncPath)
    • Globs are not permitted
  • name (string, optional) Default: value of path - Name shown to clients in F12 sync menu
    • Allows admins to specify a more user-friendly name for syncPaths such as the name of the mod or things like "client-side mods", "server mods (self-hosting only)".
  • enabled (boolean, optional) Default: true - Will clients sync this path by default
    • Clients are able to toggle all non-enforced syncPaths individual on their end, this option sets the default state for a given entry
    • "enabled": true makes a syncPath opt-out, while a value of false makes it opt-in.
    • A value of false does not prevent syncing, it just requires users to check a box before syncing will occur
  • enforced (boolean, optional) Default: false - Will clients be forced to match the server exactly
    • This changes sync behavior so that clients must strictly match the files present on the server
    • Files that are modified or deleted by the client will be redownloaded and files added by clients will be removed
    • Enforced syncPaths will override any client side exclusions users have set

      Enforced paths can cause issues when files are generated client-side or excluded server-side. Ensure that all files a client needs for mods in enforced paths are either present on the server or added to the exclusions list!

  • restartRequired (boolean, optional) Default: true - Will clients have to restart their game after updating these files
    • Some files, like server mods, do not require a restart when syncing to the client
    • If a user is attempting to sync an update with any files marked "restartRequired": true will be required to restart

      Files synced with "restartRequired": true are downloaded directly into the client's SPT folder, so make sure they won't be in use when the update is applied, otherwise it will fail.

  • silent (boolean, optional) Default: false - Will clients receive a prompt when this path is updated
    • When this option is true and updates are available they will be automatically applied in the background as the game loads
    • If a user is attempted to sync an update with any files marked "silent": false a prompt will be shown with all changes visible
    • This option plays well with "restartRequired": false and updates will be applied in the background while the game loads as usual

Tip

Sync Paths are processed from most specific to most general, so its possible to override settings for some files in a directory. For instance, to enforce only a subset of BepInEx/config

exclusions

The antithesis to the syncPaths setting is exclusions. This section of the config lets you specify files not to sync. Exclusions can be specified as a list of paths or patterns not to include. You can find the default configuration for this setting below, it demonstrates the use of both specific paths and globs for excluding files.

{
    // ...
    "exclusions": [
		// SPT Installer
		"BepInEx/plugins/spt",
		"BepInEx/patchers/spt-prepatch.dll",
		// Questing Bots
		"BepInEx/plugins/DanW-SPTQuestingBots/log",
		// Realism
		"user/mods/SPT-Realism/ProfileBackups",
		// Fika
		"user/mods/fika-server/types",
		"user/mods/fika-server/cache",
		"BepInEx/plugins/Fika.Dedicated.dll",
		// Live Flea Prices
		"user/mods/zzDrakiaXYZ-LiveFleaPrices/config",
		// Questing Bots
		"BepInEx/plugins/DanW-SPTQuestingBots/log",
		// EFTApi
		"BepInEx/plugins/kmyuhkyuk-EFTApi/cache",
		// Expanded Task Text (Accounts for bug with current version)
		"user/mods/ExpandedTaskText/src/**/cache.json",
		// Leaves Loot Fuckery
		"user/mods/leaves-loot_fuckery/output",
		// ADD MISSING QUEST WEAPON REQUIREMENTS
		"user/mods/zz_guiltyman-addmissingquestweaponrequirements/log.log",
		"user/mods/zz_guiltyman-addmissingquestweaponrequirements/user/logs",
		// Acid's Progressive Bot System
		"user/mods/acidphantasm-progressivebotsystem/logs",
		// Corter ModSync
		"BepInEx/patchers/Corter-ModSync-Patcher.dll",
		"**/*.nosync",
		"**/*.nosync.txt",
		// General server mods
		"user/mods/**/.git",
		"user/mods/**/node_modules",
		"user/mods/**/*.js",
		"user/mods/**/*.js.map",
		"**/*:Zone.Identifier"
	]
}

Tip

If you ever run into a file that changes every time you try to sync, such as a log file or a configuration, it can be easily added here to prevent clients being bombarded by update prompts.

Tip

Sync Paths can override exclusions if they are more specific. For instance, if you wanted to exclude all files in the BepInEx/plugins/SAIN directory except the plugin itself (don't do this). You could add an exclusion of BepInEx/plugins/SAIN and a sync path of BepInEx/plugins/SAIN/SAIN.dll

Client

Clients are also given a few powerful tools for customizing how sync works for them. Plenty of clients will want to customize their config with tweaks to all sorts of client-side plugins.

Be sure to familiarize yourself with how syncing works if you run into any edge cases, but by and large the following tools are all you should need to make sure you can keep all your tricked out configs as a client.

BepInEx Configuration Manager

If you are playing SPT with any mods, you are likely already familiar with the BepInEx Configuration Manager. ModSync makes use of this excellent system to expose client-side configuration. Clients can access the menu with F12 by default and scroll to where they see ModSync in the list.

Options

  • Delete Removed Files (boolean) Default: true - Will files that get deleted on the server be automatically removed
    • Enforced sync paths will have their files removed regardless of what the client sets this to
    • To understand how removed files are determined, review how syncing works
  • Synced Paths (list) - What syncPaths from the server will the client sync
    • Clients can toggle on and off any non-enforced paths
    • This might be good if server admins want to allow clients to download user/mods/ for offline play or simply for optional mods

Exclusions.json

The Exclusions.json can be thought of as the client-side equivalent of the Exclusions section in the server config. By creating a new JSON file at ModSync_Data/Exclusions.json, clients can add prevent syncing all sorts of files to their install. There are a couple of important things to remember about client-side exclusions. First, just like on the server-side, entries in this config can be files, folders, or globs. Second, this file is JSON as opposed to the server config, which is JSONC. This means that JSON comments are NOT allowed. Finally, local exclusions are always ignored when processing files in an enforced sync path.

Tip

Clients using the Fika Dedicated plugin will automatically have this file created for them. The file will be populated by default with the names of plugin files disallowed by FIKA (as of version 1.0.6).

[
	"BepInEx/plugins/AmandsGraphics.dll",
	"BepInEx/plugins/MoreCheckmarks",
	"BepInEx/plugins/kmyuhkyuk-EFTApi",
	"BepInEx/plugins/DynamicMaps",
	"BepInEx/plugins/LootValue",
	"BepInEx/plugins/CactusPie.RamCleanerInterval.dll",
	"BepInEx/plugins/TYR_DeClutterer.dll"
]
⚠️ **GitHub.com Fallback** ⚠️