fairvisor connect

fairvisor connect registers the edge with the SaaS control plane, receives an edge_id, downloads the initial policy bundle, and writes the resulting credentials to an env file.

Synopsis

fairvisor connect [--token=TOKEN] [--url=URL] [--output=PATH]

Options

FlagEnv varDefaultDescription
--tokenFAIRVISOR_EDGE_TOKEN(prompted)Registration bearer token from SaaS dashboard
--url, --saas-urlFAIRVISOR_SAAS_URLhttps://api.fairvisor.comSaaS API base URL
--output/etc/fairvisor/edge.envPath to write credentials env file

If --output path is not writable, the command falls back to ./edge.env in the current directory.

What it does

The command performs three steps:

Step 1: Register

POST {saas_url}/api/v1/edge/register
Authorization: Bearer {token}
Content-Type: application/json

{"version": "0.1.0"}

Expected response:

{ "edge_id": "edge-abc123" }

Step 2: Write env file

Creates the output file with:

FAIRVISOR_EDGE_ID=edge-abc123
FAIRVISOR_EDGE_TOKEN=<your-token>
FAIRVISOR_SAAS_URL=https://api.fairvisor.com

Step 3: Download initial bundle

GET {saas_url}/api/v1/edge/config
Authorization: Bearer {token}

The bundle JSON is written to /etc/fairvisor/policy.json.

Interactive mode

By default, the command prompts for missing values:

$ fairvisor connect
Enter registration token: ****
Enter SaaS URL [https://api.fairvisor.com]:
Registering...
Edge ID: edge-abc123
Wrote credentials to /etc/fairvisor/edge.env
Downloaded initial policy bundle

Non-interactive mode

Set CI=true or FAIRVISOR_NON_INTERACTIVE=1 to skip prompts and fail with exit code 3 if any required value is missing.

FAIRVISOR_EDGE_TOKEN=tok-xxx \
CI=true \
fairvisor connect --output /etc/fairvisor/edge.env

Using the env file

After connecting, source the env file before starting the container:

# Docker
docker run -d \
  --env-file /etc/fairvisor/edge.env \
  -v /etc/fairvisor/policy.json:/etc/fairvisor/policy.json:ro \
  ghcr.io/fairvisor/edge:latest

Or mount it as a Kubernetes secret (see Helm deployment).

Exit codes

CodeMeaning
0Registration successful, env file written
1Failed to write env file
2Network error or HTTP 4xx/5xx from SaaS
3Required token or URL not provided