Skip to content

Configuration

The Scry CLI can be configured through multiple sources.

Configuration Hierarchy

Configuration is resolved in order of priority:

  1. Command-line arguments (highest priority)
  2. Environment variables
  3. Configuration file (.storybook-deployer.json)
  4. Default values (lowest priority)

Configuration File

Create .storybook-deployer.json in your project root:

json
{
  "apiUrl": "https://api.scry.com",
  "apiKey": null,
  "dir": "./storybook-static",
  "project": "my-project",
  "version": "latest",
  "verbose": false,
  "withAnalysis": false,
  "storiesDir": null,
  "screenshotsDir": "./screenshots",
  "storybookUrl": "http://localhost:6006"
}

WARNING

Never commit API keys in the configuration file. Use environment variables for secrets.

File Properties

PropertyTypeDefaultDescription
apiUrlstringAPI defaultBackend API endpoint
apiKeystring-API key (use env var instead)
dirstring-Storybook build directory
projectstringmainProject identifier
versionstringlatestVersion string
verbosebooleanfalseEnable debug logging
withAnalysisbooleanfalseEnable story analysis
storiesDirstringAuto-detectStories directory path
screenshotsDirstring./screenshotsScreenshots output
storybookUrlstringhttp://localhost:6006Running Storybook URL

Environment Variables

All configuration options can be set via environment variables.

Primary Prefix: STORYBOOK_DEPLOYER_

VariableCorresponding Option
STORYBOOK_DEPLOYER_API_URL--api-url
STORYBOOK_DEPLOYER_API_KEY--api-key
STORYBOOK_DEPLOYER_DIR--dir
STORYBOOK_DEPLOYER_PROJECT--project
STORYBOOK_DEPLOYER_VERSION--version
STORYBOOK_DEPLOYER_VERBOSE--verbose
STORYBOOK_DEPLOYER_WITH_ANALYSIS--with-analysis
STORYBOOK_DEPLOYER_STORIES_DIR--stories-dir
STORYBOOK_DEPLOYER_SCREENSHOTS_DIR--screenshots-dir
STORYBOOK_DEPLOYER_STORYBOOK_URL--storybook-url

Alternative Prefix: SCRY_

The SCRY_ prefix is also supported and takes precedence:

VariableDescription
SCRY_API_URLAPI endpoint
SCRY_API_KEYAPI key
SCRY_PROJECT_IDProject identifier
SCRY_VIEW_URLCDN viewer URL

Usage Examples

bash
# Set environment variables
export STORYBOOK_DEPLOYER_PROJECT=my-project
export STORYBOOK_DEPLOYER_VERSION=v1.0.0
export STORYBOOK_DEPLOYER_API_KEY=scry_proj_xxx

# Run CLI (picks up env vars)
npx @scry/storybook-deployer --dir ./storybook-static
bash
# Using SCRY_ prefix (takes precedence)
export SCRY_PROJECT_ID=my-project
export SCRY_API_KEY=scry_proj_xxx
export SCRY_API_URL=https://api.scry.com

npx @scry/storybook-deployer --dir ./storybook-static

GitHub Actions Variables

For GitHub Actions, set these as repository variables and secrets:

Variables (Settings → Secrets and variables → Actions → Variables)

VariableValue
SCRY_PROJECT_IDYour project ID
SCRY_API_URLhttps://api.scry.com
SCRY_VIEW_URLhttps://view.scry.com

Secrets (Settings → Secrets and variables → Actions → Secrets)

SecretValue
SCRY_API_KEYYour API key

Workflow Usage

yaml
- name: Deploy
  env:
    STORYBOOK_DEPLOYER_API_URL: ${{ vars.SCRY_API_URL }}
    STORYBOOK_DEPLOYER_API_KEY: ${{ secrets.SCRY_API_KEY }}
    STORYBOOK_DEPLOYER_PROJECT: ${{ vars.SCRY_PROJECT_ID }}
    STORYBOOK_DEPLOYER_VERSION: ${{ github.sha }}
  run: npx @scry/storybook-deployer --dir ./storybook-static

Default Values

When not specified, these defaults are used:

OptionDefault Value
projectmain
versionlatest
verbosefalse
withAnalysisfalse
screenshotsDir./screenshots
storybookUrlhttp://localhost:6006

Example Configurations

Minimal Configuration

json
{
  "project": "my-project",
  "dir": "./storybook-static"
}

Development Configuration

json
{
  "apiUrl": "https://staging.api.scry.com",
  "project": "my-project-dev",
  "dir": "./storybook-static",
  "verbose": true
}

Production Configuration

json
{
  "apiUrl": "https://api.scry.com",
  "project": "my-project",
  "dir": "./storybook-static",
  "version": "latest",
  "verbose": false
}

With Analysis

json
{
  "project": "my-project",
  "dir": "./storybook-static",
  "withAnalysis": true,
  "storiesDir": "./src",
  "screenshotsDir": "./visual-snapshots",
  "storybookUrl": "http://localhost:6006"
}

Validation

The CLI validates configuration on startup:

  • Required fields must be present
  • URLs must be valid
  • Directories must exist (for --dir)
  • API key format is checked

Invalid configuration produces helpful error messages:

[scry] Error: --dir is required
[scry] Error: Directory './storybook-static' not found
[scry] Error: Invalid API key format

Best Practices

  1. Use environment variables for secrets - Never commit API keys
  2. Use config file for project defaults - Share common settings
  3. Override in CI - Use env vars for CI-specific values
  4. Enable verbose in development - Helps with debugging
  5. Use version control for config - Track .storybook-deployer.json

Next Steps

Released under the MIT License.