Skip to main content

Environment Variables

Use mac env to inspect values and their source. Secret values are masked.

mac env​

mac env
mac env set KEY=VALUE
mac env unset KEY
sudo mac env set --global KEY=VALUE
sudo mac env unset --global KEY

File Priority​

Highest priority first:

  1. ~/.mac/env: per-user overrides, mode 0600.
  2. /etc/mango/mac/env: node-wide overrides, mode 0640, owned by root:docker.
  3. /usr/share/mango-ai-center/env.defaults: package defaults, replaced on upgrade.

Managed files override shell values except MAC_CONFIG_DIR and MAC_IMAGE_SOURCE. MAC_IGNORE_USER_ENV=1 skips user settings; package scripts use it for node-wide operation:

sudo env MAC_IGNORE_USER_ENV=1 mac env
sudo env MAC_IGNORE_USER_ENV=1 mac restart master --wait

Place the flag after sudo env. It skips, not deletes, the user file for this invocation. Ordinary sudo mac reads user overrides. MAC_CONFIG_DIR and image-source flags still apply.

Keep master address, node name, token, and deployment settings node-wide. Shared-home user overrides can still win under sudo. Unset conflicting values in their source file and restart the role.

Image Source​

MAC_IMAGE_SOURCE=registry pulls; local builds. Its precedence is:

  1. Process environment.
  2. Node-wide value (including the package default when declared).
  3. User file.

--local / --registry on pull, start, or restart override this for one invocation.

Variable Reference​

env.defaults lists tuning variables. Registry/SDK pins are release-specific; inspect resolved tags with mac images.

Common​

VariablePurpose
MASTER_IPRequired master address for agent mode
MAC_CONFIG_DIRCompose/config directory; default /etc/mango/mac
MAC_REGISTRYMAC image registry prefix; public packages use repo.mangoboost.io/public-docker/mac
MAC_VERSIONOverride MAC image tags; unset uses the installed CLI version
SDK_AGENT_IMAGEOverride the release-pinned SDK agent image; not a moving latest tag
MAC_IMAGE_SOURCEregistry or local
MAC_OFFLINEDefault false; offline installer sets true, disabling registry fallback
NODE_NAMENode name; defaults to hostname
MAC_NODE_IP_PREFIXLiteral prefix selecting a host address; include a trailing dot for an IPv4 subnet
TZIANA timezone; CLI detects the host, raw Compose falls back to UTC
MAC_LOG_LEVELdebug, info (default), warn, or error; restart to apply
MAC_AUTH_ENABLEDUser JWT authentication; default true
MAC_ADMIN_PASSWORDSeeds admin only when no users exist; default admin
MAC_ALLOWED_ORIGINSAllowed credentialed CORS origins; unset sends no CORS headers
MAC_TRUSTED_PROXIESTrusted proxy IPs/CIDRs for forwarded client addresses; unset trusts the web UI container

Stale MAC_VERSION pins can run old images. Compare mac version with mac info and remove unwanted pins from both env files.

Node Authentication​

VariablePurpose
MAC_NODE_TOKENShared master/agent token; recommended 32–128 characters from A-Z, a-z, 0-9, _, -
MAC_NODE_TOKEN_FILERead token from a file; inline token takes precedence
MAC_NODE_AUTH_MODEsys-manager policy for emergency/missing-token cases; see installed defaults
MAC_NODE_ALLOW_IPSOptional source IP/CIDR filter for sys-manager; include master, loopback, and required bridge addresses
MAC_REGISTRY_ALLOWLISTAdditional registries permitted for node updates

Privileged master start generates /etc/mango/mac/node_token if unset; an unwritable directory falls back to a user token. Root-only files require sudo for start/restart. Check user overrides. Securely copy the token into every agent’s node-wide MAC_NODE_TOKEN; it is not distributed, and mismatches prevent enrollment. This token protects node control, SDK gateway, and log relay separately from user JWTs. Keep it identical across nodes and restart master before agents when enabling/rotating it. Agent token files must be readable inside each consuming container; a host-only MAC_NODE_TOKEN_FILE can enroll but fail control authentication. Prefer the inline node-wide token.

Service Ports​

VariablePurpose
MASTER_API_PORTMaster HTTP API; default 28080
MASTER_WEB_PORTDashboard; default 23000
PROMETHEUS_PORTMaster Prometheus host port; default 29090
LOKI_PORTMaster Loki port; default 29210
PROMETHEUS_BIND_ADDR, LOKI_BIND_ADDRDefault 127.0.0.1; these services have no built-in authentication
PROMETHEUS_RETENTION_SIZEMetrics storage cap; default 20GB, with 30-day retention
SDK_AGENT_INTERNAL_PORTSDK agent loopback REST port; default 28100, reached through authenticated sdk-gate on 28000
SNMP_PORTSwitch SNMP destination port; default 161
ALERT_RULES_PATHAPI-server alert rules JSON location

Exporter port settings on the master change target addresses, not agent listeners. See Installation for the ports to permit between hosts.

Logs and Agent Health​

VariablePurpose
LOKI_PUSH_URLAgent log destination; defaults to the master's authenticated /api/v1/logs/push relay
LOKI_PUSH_MAX_LINESMaximum log lines per push; default 2000
MAC_HEALTH_CHECK_INTERVALAgent health poll interval in seconds; default 30
MAC_HEALTH_CHECK_TIMEOUTProbe timeout in seconds; default 5
MAC_TARGET_GRACE_SECRetain offline agent scrape targets for this many seconds; default 600
SMARTCTL_TIMEOUT_SECPer-device SMART deadline; default 30 seconds
SMART_INTERVAL_SECSMART refresh interval; default 300 seconds

Agent log positions persist in /var/lib/mango-ai-center/sys-exporter. All-in-one uses the relay container name on mac-network.

TLS (HTTPS)​

VariablePurpose
MAC_TLS_ENABLEDEnable API/dashboard HTTPS; default false
MAC_TLS_CERT_DIRHost directory with server.crt and server.key, mounted into containers
MAC_TLS_PORTAPI HTTPS port; default 28443
MAC_WEB_TLS_PORTDashboard HTTPS port; default 23443
MAC_TLS_CERT_FILEContainer cert path; default /etc/mac/certs/server.crt
MAC_TLS_KEY_FILEContainer key path; default /etc/mac/certs/server.key

Switch Access​

VariablePurpose
SWITCH_USERSSH user; default admin
SWITCH_PASSWD_LISTComma-separated SSH password candidates
SWITCH_PASSWDLegacy single password when the list is unset
SNMP_COMMUNITYSNMP community; default public
SWITCH_MGMT_CIDRSAllowed switch management CIDRs/IPs receiving SNMP/gNMI credentials; empty allows all discovered addresses
MAC_SSH_KNOWN_HOSTSStrict OpenSSH known_hosts path inside api-server; mount/copy the file into the container

Without explicit known_hosts, API data stores first-use keys and rejects changes. Restrict SWITCH_MGMT_CIDRS to your management network.

gNMI Streaming Telemetry​

Capable SONiC switches use gNMI; other switches fall back to SNMP. LLDP discovery uses SNMP.

VariablePurpose
GNMI_ENABLEDDefault true; false forces SNMP
GNMI_PORTDefault 8080
GNMI_USERNAME, GNMI_PASSWORDgNMI credentials, empty by default
GNMI_TLS_MODEnone (default), skip-verify, or ca
GNMI_TLS_CA_FILECA path inside switch-exporter for ca mode
GNMI_SAMPLE_INTERVAL_SECCounter subscription interval; default 5
GNMI_PATH_MODEauto (default), sonic-db, or openconfig
GNMI_MAX_FAILURESFailures before SNMP fallback; default 5
GNMI_RETRY_COOLDOWN_SECDelay before retrying gNMI; default 600

LLMBoost​

VariablePurpose
LLMBOOST_HOST_PORTSExplicit ports to probe on online agents for /v1/models; unset disables probing
LLMBOOST_ENGINE_ENDPOINTSAdditional reachable OpenAI-compatible engine URLs
LLMBOOST_ENABLEDUnset follows configured discovery paths; false disables federation
LLMBOOST_DASHBOARD_URLLink to the deployment's Grafana
LLMBOOST_SERVING_NAMESPACES, LLMBOOST_PLATFORM_NAMESPACESOverride Kubernetes namespace discovery
K8S_API_ENDPOINT, K8S_API_TOKENKubernetes API URL and ServiceAccount token
K8S_API_CA_CERTCA path inside api-server
K8S_KUBECONFIGKubeconfig path inside api-server; exec/auth-provider credentials are unsupported
K8S_NAMESPACESOptional namespace scope
K8S_INSECURE_SKIP_VERIFYSkip Kubernetes TLS verification; avoid in production

Host/Kubernetes discovery can coexist. Apply /etc/mango/mac/k8s/mac-llmboost-rbac.yaml to the target cluster. Paths are inside api-server; host env paths do not mount files. See LLMBoost.

MASS and BMC​

VariablePurpose
MASS_API_ENDPOINTMASS Manager API URL; unset disables integration
MASS_DASHBOARD_URLMASS dashboard link
MASS_USERNAME, MASS_PASSWORDMASS service identity
MAC_BMC_USER, MAC_BMC_PASSWORDBMC fallback for nodes without individual configuration
MAC_BMC_ENCRYPT_KEYOptional BMC credential encryption key, at least 32 bytes
MAC_BMC_KEY_FILEGenerated key location; default /app/data/.bmc_key

The default BMC key is generated in API data; preserve it with mac.db. Persist MASS credentials node-wide; runtime credentials are lost on restart.

Inspecting Current State​

mac env labels default, global, and user sources. Restart after changes and check mac info. Do not share unmasked environments or credential-bearing files.