Enum Class ConfigFile

java.lang.Object
java.lang.Enum<ConfigFile>
org.frontcache.io.ConfigFile
All Implemented Interfaces:
Serializable, Comparable<ConfigFile>, Constable

public enum ConfigFile extends Enum<ConfigFile>
The config files the management API will write, and the only names set-config accepts.

This enum IS the allowlist

A caller sends a logical id - bots, guard-rules - and never a path or a file name. byId(String) maps it to the file name held here; anything unrecognized is refused. That is the whole path-traversal defence, and it is a closed set rather than a check on a caller-supplied string, because a check is a thing that can be written slightly wrong. There is no reason for a caller to name a file, so it cannot. One file per Configs screen in the console, and deliberately no more: conf/frontcache.properties is excluded because it holds front-cache.api-key (a console editing it could lock itself out of the node it is editing), because FCConfig has no live re-read at all, and because a typo in it is a node that does not serve.
  • Enum Constant Details

    • RESILIENCE

      public static final ConfigFile RESILIENCE
    • GUARD_RULES

      public static final ConfigFile GUARD_RULES
    • BOTS

      public static final ConfigFile BOTS
    • DYNAMIC_URLS

      public static final ConfigFile DYNAMIC_URLS
    • FALLBACKS

      public static final ConfigFile FALLBACKS
  • Method Details

    • values

      public static ConfigFile[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ConfigFile valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getId

      public String getId()
      The id a caller sends, and the one the console's screens are keyed by.
    • getFileName

      public String getFileName()
      The name under FRONTCACHE_HOME/conf - never composed from caller input.
    • byId

      public static ConfigFile byId(String id)
      Returns:
      the file, or null when the id is not one of ours
    • ids

      public static String ids()
      The accepted ids, for an error message that tells the caller what it should have sent.