Class ConsulLookup

java.lang.Object
org.kiwiproject.dropwizard.consul.config.ConsulLookup
All Implemented Interfaces:
org.apache.commons.text.lookup.StringLookup

public class ConsulLookup extends Object implements org.apache.commons.text.lookup.StringLookup
A custom StringLookup implementation using Consul KV as lookup source.
  • Constructor Details

    • ConsulLookup

      public ConsulLookup(org.kiwiproject.consul.Consul consul)
      Create a new instance with strict behavior.
      Parameters:
      consul - Consul client
    • ConsulLookup

      public ConsulLookup(org.kiwiproject.consul.Consul consul, boolean strict)
      Constructor
      Parameters:
      consul - Consul client
      strict - true if looking up undefined environment variables should throw a UndefinedEnvironmentVariableException, false otherwise.
      Throws:
      io.dropwizard.configuration.UndefinedEnvironmentVariableException - if the environment variable doesn't exist and strict behavior is enabled.
  • Method Details

    • lookup

      public @Nullable String lookup(String key)
      Specified by:
      lookup in interface org.apache.commons.text.lookup.StringLookup
      Throws:
      io.dropwizard.configuration.UndefinedEnvironmentVariableException - if the environment variable doesn't exist and strict behavior is enabled.