Skip to contents

Validates that an API key is non-empty. Throws an informative error directing the user to set the appropriate environment variable.

Usage

api_key_required(key, service_name)

Arguments

key

Character. The API key to validate.

service_name

Character. Name of the service for error message.

Value

The key invisibly if valid.

See also

Other config-utils: api_config(), config-utils

Examples

if (FALSE) { # \dontrun{
key <- Sys.getenv("ART_GEMINI_KEY")
api_key_required(key, "GEMINI")
} # }