Skip to main content

How to Configure Spectacles

Most Spectacles parameters can be specified from the command line, from a YAML config file, or as an environment variable. In the Reference section, you'll find a list of global flags and validator-specific flags.

Precedence

Parameters specified via the command line will override those specified by other means. Similarly, parameters in environment variables will override parameters in the config file.

Configuring via a config file

The most convenient approach for parameters that you always need to pass, like your client ID, client secret, or project, is to save your Spectacles configuration as a YAML file (.yaml or .yml).

Here's how an example config file might look. You can name it whatever you want.

looker_configuration.yaml
base_url: https://analyzely.looker.com
client_id: HpB53crD3DMDkdJPCRc
client_secret: jDRSM6ZGG9D5WH3r5FynQ9c

When you call Spectacles, use the --config-file flag to specify the path to your config file.

spectacles connect --config-file looker_configuration.yaml

Configuring via environment variables

You can also configure Spectacles via environment variables. Not all flags have environment variables associated with them. The flags that do are listed in the Reference section of the docs.

Here's how you would configure your API credentials via environment variables:

export LOOKER_BASE_URL=https://analyzely.looker.com
export LOOKER_CLIENT_ID=HpB53crD3DMDkdJPCRc
export LOOKER_CLIENT_SECRET=jDRSM6ZGG9D5WH3r5FynQ9c

spectacles connect