Skip to main content

Configuration

Most options in the CLI can be set a few different ways---some through command-line parameters, others through environment variables, and others in configuration files.

Context#

Most commands need to know three pieces of context to run:

  • Your Mesmer tenant (e.g. your.tenant.here.mesmerhq.com)
  • Your project ID (like 5e8db6d8b67fb86e9ccb8bad)
  • Your authentication token

Almost every command needs to know your tenant and auth token; most need to know your project.

Generally, the CLI can figure these out from your configuration files and environment. If it can't, and you're running interactively, it will generally prompt you to pick from a list of possibilities. Sometimes, it can't figure out what value to use, and requires one to be passed explicitly with a global option.

More precisely, it will follow these rules when trying to resolve tenant, project, and auth token:

Resolving tenant#

To resolve your tenant, the CLI will check the following places, in this order:

  1. First, if an auth tenant is specificed via a global override (the MESMER_TENANT environment variable or --tenant global option), it'll use it.
  2. Otherwise, if we can find a .mesmer.yml file, use the value from that. You can create this file with mesmer init.
  3. Otherwise, if you're authenticated to exactly one tenant, use that. (see: mesmer auth list)
  4. Otherwise, (and only if we're running interactively), render a list prompt for all the tenants in your authentication config.

If none of these steps work, the CLI will exit with an error.

Resolving project#

To resolve your project, the CLI will check the following places, in this order:

  1. First, if an auth tenant is specificed via a global override (the MESMER_PROJECT environment variable or --project global option), it'll use it.
  2. Otherwise, if we can find a .mesmer.yml file, use the value from that. You can create this file with mesmer init.

If none of these steps work, the CLI will exit with an error.

Resolving the auth token#

To resolve your auth token, the CLI will check the following places, in this order:

  1. First, if an auth tenant is specificed via a global override (the MESMER_AUTH_TOKEN environment variable or --token global option), it'll use it.
  2. Otherwise, it will resolve your tenant, and use the appropriate token for it from your authentication config.

Configuration files#

The CLI stores its global configuration, such as authentication information, in a place that makes sense for your platform:

PlatformLocation
Linux$XDG_CONFIG_HOME/mesmer, or $HOME/.config/mesmer
macOS$HOME/Library/Preferences/mesmer
Windows%appdata%\mesmer

Throughout the docs, we'll refer to this location as the 'config directory', $CONFIG_DIR, or similar.

Authentication config#

The file $CONFIG_DIR/auth.yml contains stored tokens for each tenant you're authenticated to. You can view its contents, and check token validity, with mesmer auth list

Here's an example of what this file looks like:

# auth.yml---# `tenants` contains a list of tenant URL/token pairs for all the# tenents you have signed in to. You can check that these credentials# work with `mesmer auth list`.tenants:  - tenantUrl: your-tenant.mesmerhq.com # The hostname of a Mesmer tenant    token: auth.token.here # A valid auth token for that tenant

Project config#

For each project, mesmer init writes out a file .mesmer.yml containing tenant and project IDs. This is intended to be checked in to version control, and versioned alongside your app's code.

Here's an example of what this looks like:

# .mesmer.yml---# a Mesmer project IDprojectId: 5ee00107f73ce45ba4d041e8
# Hostname of the Mesmer tenant for that `projectId`tenantUrl: your-tenant.mesmerhq.com

Configuring a Proxy#

The Mesmer CLI can be configured to use an HTTP proxy to connect to the Internet.

  • Set the HTTPS_PROXY environment variable to the proxy server you want to use
  • If this server presents an untrusted certificate, you can force the CLI to accept it by setting the MESMER_HTTP_ACCEPT_CERTIFICATE environment variable to the location of a PEM-encoded CA certificate.
# Set the address of your proxy$ export HTTPS_PROXY="http://your.proxy"
# (Optional, only if you need to manually trust your proxy's certificate)$ export MESMER_HTTP_ACCCEPT_CERTIFICATE="/path/to/ca-cert.pem"
# This will now make requests through the proxy$ mesmer project describe