Interface ISecretsContext

All Known Implementing Classes:
EditorPushProps, EditorRuntimeBuilderProps, EditorServerSettings, ModuleApp, PushProps, RuntimeBuilderProps, ServerRuntimeBuilderProps, ServerSettings

public interface ISecretsContext
Interface implemented by the root property container that gives the secret properties below it their context in the secrets store: the application (app.<appID>), the iiziRun build (run.<app_id>) or the server configuration (server.<name>). The key of a secret is the context followed by the atom path of the property from that root, separated by KEY_SEPARATOR, e.g. server.spacy-debug/$mail.mail/password; an atom name cannot contain the separator.

Only the roots implement this interface. A secret anywhere below finds its context by walking up to the nearest ancestor implementing it. A container that implements it but is not a root of its own at the moment - the server configuration's own $push, a PushProps that no loader gave a context (ruling PP-D-2) - answers false to isSecretsRoot(): it belongs to its nearest ancestor root, whose context and keys it answers with, and whose own secrets its marked members are. The store itself is reached through ISecretsStore.

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The separator between the context and the atoms of a key, and between the atoms: "/".
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the secrets context name of this root.
    default String
    Gets the key of a secret property below this root.
    default boolean
    Tells whether a secret-marked property below this root is optional: one whose absence from the store is a configuration of this machine, not an error, and which the root reports itself.
    default boolean
    Tells whether this container is a root of its own: the one whose context the secrets below it take, resolved and committed with the root's own, as SecretsContexts does.
  • Field Details

    • KEY_SEPARATOR

      static final String KEY_SEPARATOR
      The separator between the context and the atoms of a key, and between the atoms: "/".
      See Also:
  • Method Details

    • getSecretsContext

      String getSecretsContext()
      Gets the secrets context name of this root.
      Returns:
      The context name, e.g. app.com.mindus.icu, or null when this root has no identity yet, in which case no secret below it can be resolved.
    • isSecretsRoot

      default boolean isSecretsRoot()
      Tells whether this container is a root of its own: the one whose context the secrets below it take, resolved and committed with the root's own, as SecretsContexts does. The default is true. A container that answers false is a member of its nearest ancestor root implementing this interface: SecretsContexts walks through it as through any container, and its getSecretsContext() and getSecretsKey(GProp) answer for that root.
      Returns:
      true when this container is a root of its own, false when it belongs to its nearest ancestor root.
    • getSecretsKey

      default String getSecretsKey(GProp<?> prop)
      Gets the key of a secret property below this root. The default is the context, then the atom path of the property from this root, each part separated by KEY_SEPARATOR. A root overrides this method for a property whose atom path is not stable.
      Parameters:
      prop - The secret property, a descendant of this root.
      Returns:
      The key, or null when there is no context, when this root is not a property container, or when the property is not below this root.
    • isSecretOptional

      default boolean isSecretOptional(GProp<?> prop)
      Tells whether a secret-marked property below this root is optional: one whose absence from the store is a configuration of this machine, not an error, and which the root reports itself. SecretsStores.resolve then logs nothing for it - the SEVERE of a missing secret on a production server is for the secrets a configuration cannot do without. The default is false. PushProps answers true for an application's two Push Notification secrets, whose absence switches the transport off for that application, said once per application (CC-FIX-PUSH-SECRET-MISSING, ruling T5-D-1).
      Parameters:
      prop - The secret property, a descendant of this root.
      Returns:
      true when the root reports the property's absence itself.