IP Intelligence services for 51Degrees Pipeline

fiftyone.ipintelligence.shared.testhelpers.KeyUtils Class Reference

Detailed Description

Helpers to obtain keys from the environment.

Static Public Member Functions

static String getResourceKey (String legacyKeyName)
 Obtain a resource key from an environment variable or a system property.
static String getNamedKey (String keyName)
 Obtain a key either from environment variable or from a property.
static boolean isInvalidKey (String keyValue)
 Evaluate whether a key might be valid.

Static Public Attributes

static final String RESOURCE_KEY_VARIABLE = "_51DEGREES_RESOURCE_KEY"
 Name of the aligned environment variable or system property which supplies the resource key.
static final String RESOURCE_KEY_ENV_VAR = "51DEGREES_RESOURCE_KEY"
 The old name of RESOURCE_KEY_VARIABLE, read only when that one is not set.

Member Function Documentation

◆ getNamedKey()

String fiftyone.ipintelligence.shared.testhelpers.KeyUtils.getNamedKey ( String keyName)
static

Obtain a key either from environment variable or from a property.

Try resource key as env var, then as upper case env var, the system property

◆ getResourceKey()

String fiftyone.ipintelligence.shared.testhelpers.KeyUtils.getResourceKey ( String legacyKeyName)
static

Obtain a resource key from an environment variable or a system property.

The aligned name RESOURCE_KEY_VARIABLE is checked first. When it is not set or is empty the deprecated RESOURCE_KEY_ENV_VAR is checked, and its first use is reported on standard error. The supplied legacy name is checked last. Each name is looked up using getNamedKey(String).

Parameters
legacyKeyNamelegacy name to try when the aligned name is not set
Returns
the resource key, or null if no name is set

◆ isInvalidKey()

boolean fiftyone.ipintelligence.shared.testhelpers.KeyUtils.isInvalidKey ( String keyValue)
static

Evaluate whether a key might be valid.

Parameters
keyValuevalue to test
Returns
boolean

Member Data Documentation

◆ RESOURCE_KEY_ENV_VAR

final String fiftyone.ipintelligence.shared.testhelpers.KeyUtils.RESOURCE_KEY_ENV_VAR = "51DEGREES_RESOURCE_KEY"
static

The old name of RESOURCE_KEY_VARIABLE, read only when that one is not set.

Deprecated
use RESOURCE_KEY_VARIABLE, and set the variable it names in place of this one.

◆ RESOURCE_KEY_VARIABLE

final String fiftyone.ipintelligence.shared.testhelpers.KeyUtils.RESOURCE_KEY_VARIABLE = "_51DEGREES_RESOURCE_KEY"
static

Name of the aligned environment variable or system property which supplies the resource key.

This name is checked before any legacy name.