You are viewing a potentially older version of this package. View all versions.
Manke-ServerConfigSync-0.1.1 icon

ServerConfigSync

Server-enforced settings for any mod: players use the server's BepInEx config values while connected, without mod authors adding sync support. Players' own config files are never changed.

Date uploaded a week ago
Version 0.1.1
Download link Manke-ServerConfigSync-0.1.1.zip
Downloads 24
Dependency string Manke-ServerConfigSync-0.1.1

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2351 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2351

README

ServerConfigSync

Make every player on your Valheim server use the server's settings for any mod, even mods that have no server sync of their own.

Many mods read their settings from a BepInEx .cfg file on each player's PC. Without a sync system, every player can have different values: stack sizes, arrow speed, crafting rules, and so on. Some mod authors add sync support (ServerSync, Jötunn), many don't. ServerConfigSync does it for all of them, with nothing to change in the mods themselves.

How it works

  • The server is the source of truth. When a player joins, the server sends the values from its own BepInEx config files.
  • The player's game applies them in memory only. The player's .cfg files are never overwritten, and their own values come back as soon as they disconnect. Playing on several servers, or single player, is unaffected.
  • Mods are notified through the normal BepInEx SettingChanged event, so mods that react to setting changes pick up the server's values immediately.
  • If the admin edits a .cfg file while the server is running, the new values are pushed to connected players (can be turned off).

Installation

Install it on the server and on every player's game (with r2modman, Gale or Thunderstore Mod Manager, or by copying ServerConfigSync.dll into BepInEx/plugins).

Players without the mod can still join, they just keep their own settings, unless the server sets RequireClientMod = true.

Configuration

The settings are in BepInEx/config/peppeaiello.ServerConfigSync.cfg. The server only reads the Server section and players only read the Client section.

Server

Setting Default Description
Enabled true Send the server's settings to players who join.
SyncMode All All: every mod. Whitelist: only the mods in PluginList. Blacklist: every mod except those in PluginList.
PluginList (empty) Comma-separated plugin GUIDs for Whitelist/Blacklist. A mod's GUID is written at the top of its .cfg file.
ExcludedEntries (empty) Comma-separated entries that are never synced: GUID, GUID:Section or GUID:Section:Key, with * as a wildcard. Example: ishid4.mods.betterarchery:Bow Zoom:*
SyncKeybinds false When off, hotkeys and keyboard shortcuts stay as each player set them.
SkipSelfSyncingMods true Skip mods that already sync their settings (with ServerSync, or with their own sync code when it can be recognized) and Jötunn entries marked admin-only.
AllowedSecretEntries (empty) Entries that look like secrets are never sent (see below). List here, in the ExcludedEntries format, the ones you really want to send.
RequireClientMod false Refuse players who don't have ServerConfigSync.
LiveUpdates true Reload a .cfg file edited while the server runs and push the new values to connected players.

When the server starts, its log says how many entries from how many mods will be sent, and which ones were skipped and why.

Client

Setting Default Description
AcceptServerConfig true Apply the server's settings while connected.
ShowStartupWarning false Also show in game which mods might only read their settings at startup (see Limitations). It's a guess, so by default it only goes to the log.
ListAffectedMods true Name those mods in that message.

Debug

Setting Default Description
VerboseLogging false Log every synced entry (old and new value).

What is sent, and what is not

Only config values are sent. No files and no code, nothing else from the server.

Never sent:

  • BepInEx.cfg and ServerConfigSync's own settings.
  • Entries that look like secrets: a section or key mentioning a webhook, token, password, secret, API key, auth, credential, URL, URI, endpoint or connection string, and any value that is a URL. A Discord webhook in a server-side mod's config never leaves the server. If you really want one of these to be sent, list it in AllowedSecretEntries.
  • Keybinds, unless SyncKeybinds is on.
  • Mods and entries the admin excluded.

Security on the player's side

  • Data is accepted only from the server the player is connected to.
  • Only existing entries of mods that are loaded are changed. Nothing is created.
  • Transfers are size-limited (compressed and uncompressed), and malformed data is rejected.
  • Nothing is ever written to disk or executed. If a mod saves its config while you're connected, your own values are what get written.
  • If you change a synced setting while connected (for example in a config manager), it's saved as your value, and the server's value stays active until you leave.

Limitations

  • Mods that only read their settings at startup (for example, ones that set up items or recipes once when the game loads) won't see values that arrive when you join. ServerConfigSync can't detect this with certainty. It writes in the log which mods with changed values don't listen for setting changes, but many of those work fine anyway because they read the value every time they use it.
  • Only the main config file of each mod (<GUID>.cfg) is synced. Extra .cfg files a mod creates itself, and YAML/JSON configs, are not.
  • Entries a mod creates only later in the game (after you join) are not synced.
  • Some mods sync their settings with their own code that can't be recognized automatically. Syncing them twice is harmless (both send the server's values, and players still get their own values back), but if you prefer, add them to PluginList with SyncMode = Blacklist.

Building from source

Requires the .NET SDK (8 or later) and a Valheim install with BepInEx (game or dedicated server) to compile against.

export VALHEIM_DIR=/path/to/Valheim
./build.sh

This produces dist/ServerConfigSync-<version>.zip, a Thunderstore package. Tests that run without the game:

dotnet run --project tests/ServerConfigSync.Tests

License

MIT. Source code: https://github.com/peppeaiello/ServerConfigSync

CHANGELOG

Changelog

0.1.3

  • The plugin GUID is now Manke.ServerConfigSync, so the settings file is BepInEx/config/Manke.ServerConfigSync.cfg. Settings in the old peppeaiello.ServerConfigSync.cfg are carried over automatically the first time.

0.1.2

  • Documentation only: clearer README and changelog. No code changes.

0.1.1

  • Better detection of mods that already sync their own settings, including Jötunn admin-only entries.
  • Players' own values are always restored correctly when they disconnect, even when another mod's sync had changed them first.
  • The in-game message only says that server settings were applied. Mods that may only read settings at startup are listed in the log; ShowStartupWarning shows them in game too.

0.1.0

  • First test release: the server's BepInEx config values for any mod are applied in memory on players' games while connected, and restored when they disconnect.
  • Whitelist/blacklist of mods, per-entry exclusions, keybinds kept local, secrets never sent, mods that sync themselves skipped.
  • Live updates when a config file changes on the server.
  • Optional requirement for players to have the mod.