Class ConfigWriteAction

java.lang.Object
org.frontcache.io.ConfigWriteAction

public class ConfigWriteAction extends Object
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 Details

    • CONFIG_WRITE_PROPERTY

      public static final String 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:
  • 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 from ApiKey.isAuthorizedToWrite - passed in rather than read here, because this class has no request to read it from