Account for runtime RCON passwords in config drift
This commit is contained in:
@@ -2,6 +2,7 @@ import { getVersionContent } from './scripts.js';
|
||||
import { composeServerCfg } from './config-compose.js';
|
||||
import { getBaselineForScope, getVersion, listPromotedOverlaysForScope } from './scripts.js';
|
||||
import { selectedZombieMap, mapRotation } from './map-aliases.js';
|
||||
import { applyRuntimePassword } from './runtime-config.js';
|
||||
|
||||
export const MAP_CONFIG_FILE = 'electric_cherry_map.cfg';
|
||||
|
||||
@@ -12,7 +13,7 @@ export function getServerMapConfig(game: string | null, map: string | null, mapS
|
||||
}
|
||||
|
||||
/** The promoted config used for first boot and drift reconciliation. */
|
||||
export function getPromotedServerConfig(game: string | null, map: string | null, mapSlug?: string | null): Buffer | null {
|
||||
export function getPromotedServerConfig(game: string | null, map: string | null, mapSlug?: string | null, rconPassword?: string | null): Buffer | null {
|
||||
if (!game) return null;
|
||||
const baseline = getBaselineForScope('game', game);
|
||||
if (!baseline?.current_version_id) return null;
|
||||
@@ -26,5 +27,5 @@ export function getPromotedServerConfig(game: string | null, map: string | null,
|
||||
const current = overlay.current_version_id ? getVersion(overlay.current_version_id) : undefined;
|
||||
return current ? [{ id: overlay.id, text: getVersionContent(current.id).toString('utf8') }] : [];
|
||||
});
|
||||
return Buffer.from(composeServerCfg(getVersionContent(version.id).toString('utf8'), overlays, game, map, mapSlug), 'utf8');
|
||||
return Buffer.from(applyRuntimePassword(composeServerCfg(getVersionContent(version.id).toString('utf8'), overlays, game, map, mapSlug), rconPassword), 'utf8');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user