Class ConfigWriteAction
java.lang.Object
org.frontcache.io.ConfigWriteAction
What
set-config actually does, with no HttpServletRequest in sight.
Separate from FrontCacheIOServlet so it can be tested for what matters here - the gates,
the allowlist, the normalization, the conflict check, the backup, the atomic replace - without
standing up a servlet container and a live FrontCacheEngine. The servlet keeps only the
parameter extraction.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SetConfigActionResponseWrites one config file and applies it.
-
Field Details
-
CONFIG_WRITE_PROPERTY
Property that turns runtime config writes off for this node. Not paranoia: a fleet whose conf/ is deployed from git, Ansible or a container image must not be editable from a web UI, because the next deployment silently reverts the edit and the drift is invisible until then. An operator in that position needs one property, not a policy.- See Also:
-
PLUGIN_PREFIX
Thefileid of a plugin's config:plugin:<id>. The file it writes is the one the plugin's manifest names - read from the loaded manifest, never from the caller - so the allowlist is still closed: the five core files, and the config of each plugin this node loaded.- See Also:
-
-
Method Details
-
perform
public static SetConfigActionResponse perform(String fileId, String content, String baseHash, boolean apply, boolean authorizedToWrite) Writes one config file and applies it.The order of the steps is the contract
Gate, resolve, normalize, validate, compare, back up, write, apply. Everything that can refuse the write happens before anything is written, so a refusal never leaves a half-applied change - and validation runs before the conflict check so an operator with both a stale tab and a syntax error is told about both.- Parameters:
authorizedToWrite- the caller's verdict fromApiKey.isAuthorizedToWrite- passed in rather than read here, because this class has no request to read it from
-