Managing Connections

Connections are specified in the appconfig.json file as an array of connections. If more than one connection of a given type is specified, the connections must be given a name using the name attribute. When a connection requires a password or secret for authentication, that secret is not specified in the appconfig.json file but instead as an environment variable. The name of the environment variable used to hold the secret must be configured with the connection. The environment variable values are set as part of the Docker configuration (typically done by the Hashpath team unless self-hosting).

Option Req’d Example Description
name N “my_first_connection” Name that will be used to identify the connection when running queries. Only required if there is more than one connection of the same type.
type Y One of the following:
- “looker_embed”
- “chartio”
- “kibana”
- “periscope”
- “metabase”
- “looker_api”
- “snowflake”
- “bigquery”
- “postgres”
- “elasticsearch”
The type of the connection. Connections are used for both embedding (using an iFrame) and querying using an API to populate native visualizations.
env_var Y “SNOWFLAKE_PASSWORD” The name of the environment variable that will hold the secret associated with the connection. This secret is set as part of the Docker configuration of White Label Data.

Adding connection environment variables to your local development environment

When you add a connection that requires a secret, you will need to update your local development environment to pass that secret as an environment variable to your instance. This is done by editing the docker-compose.yml file that you created when you set up that environment.

Edit the file and add the environment variable(s) to the environment section of your instance:

wldinstance:
    image: hashpath/hashpathapp:dev
    container_name: wldinstance
    restart: always
    ports:
      - "2525:80"
    volumes:
      - <local_repository_path>:/opt/services/hashpathapp/hashpathcustomer/config
      - <local_repository_path>:/opt/services/hashpathapp/hashpathcustomer/templates/custom
    environment:
      - "HASHPATH_APPNAME=wldinstance"
      - "VIRTUAL_HOST=localhost"
      - "STATIC_URL=http://localhost:2526"
      - "AUTH0_DOMAIN=hashpathapp.auth0.com"
      - "AUTH0_KEY=<auth0_key>"
      - "AUTH0_SECRET=<auth0_secret"
      - "AUTH0_API_DOMAIN=<auth0_domain>"
      - "HASHPATH_DEBUG=True"
      - "HASHPATH_LOCAL=True"
      - "MAPBOX_TOKEN=pk.eyJ1IjoiaGFzaHBhdGgiLCJhIjoiY2p3Z3pxbHB0MDFrZDQzbnMwNmF1d3MybyJ9.0lLpesaHfYsX0-UivfyCzw"
      - "SNOWFLAKE_PASSWORD=mysnowflakepassword"

Note the last line that was added containing the name and value of the environment variable specified in the connection. Now restart the instance with the new environment variable:

docker-compose up -d