My App
Credentials

CLI Usage

Using the Emofy CLI with per-env credentials — login, use, publish, and CI-friendly patterns.

CLI Usage

The CLI stores a versioned config at ~/.config/emofy/config.json (POSIX) or %APPDATA%\emofy\config.json (Windows), chmod 0600. Since v0.2 the shape is:

{
  "version": 2,
  "currentEnv": "dev",
  "envs": {
    "dev":        { "token": "…", "apiBaseUrl": "…", "orgSlug": "…" },
    "staging":    { "token": "…", "apiBaseUrl": "…", "orgSlug": "…" },
    "production": { "token": "…", "apiBaseUrl": "…", "orgSlug": "…" }
  }
}

v1 configs are auto-migrated on first v2-aware command; the existing token is wrapped as envs.dev.

Commands

# Switch active environment
emofy use staging

# Print active env + clientId hint + api URL
emofy current-env

# Login against a specific env (mints the token; writes under envs.<env>)
emofy login --env staging

# Publish a build to a channel — the CLI picks the matching env credential
emofy publish --channel staging

CI patterns

For CI pipelines, prefer environment variables over .emofy-config.json:

# Option 1: one-shot token via flag
EMOFY_TOKEN=$STAGING_TOKEN emofy publish --channel staging --token "$STAGING_TOKEN"

# Option 2: per-env env vars with bash substitution
export EMOFY_STAGING_TOKEN=...
emofy publish --channel staging --token "$EMOFY_STAGING_TOKEN"

--token-file is not supported in this release; use shell command substitution (--token $(cat /run/secrets/emofy-token)) instead.

Error: CREDENTIAL_ENV_MISMATCH

If the CLI's active env doesn't match the --channel you're publishing to, the backend returns 403 CREDENTIAL_ENV_MISMATCH. Switch the active env before publishing:

emofy use production
emofy publish --channel production

See mismatch-troubleshooting for the full recovery recipe.

On this page