or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

auto-updater.mdconfiguration.mdcore-updaters.mdevents.mdindex.mdplatform-updaters.mdproviders.mdtypes.md
tile.json

configuration.mddocs/

Configuration and Setup

Configuration options for different hosting providers and update server setups, including provider-specific settings and advanced configuration patterns.

Capabilities

Provider Configuration Types

Base configuration interfaces for all supported update providers.

/**
 * Base configuration for all providers
 */
interface PublishConfiguration {
  provider: string;                     // Provider type identifier
  publishAutoUpdate?: boolean;          // Whether to publish auto-update files (default: true)
}

/**
 * Union type of all provider configuration options
 */
type AllPublishOptions = 
  | GenericServerOptions 
  | GithubOptions 
  | S3Options
  | SpacesOptions
  | BitbucketOptions 
  | GitlabOptions 
  | KeygenOptions
  | CustomOptions
  | string; // Simple URL string for generic provider

Generic Server Configuration

Configuration for custom HTTP servers and static file hosting.

/**
 * Generic HTTP server provider configuration
 */
interface GenericServerOptions extends PublishConfiguration {
  provider: "generic";
  url: string;                          // Base server URL
  channel?: string;                     // Update channel name (default: "latest")
  useMultipleRangeRequest?: boolean;    // Enable multi-range requests for efficiency
  publishAutoUpdate?: boolean;          // Publish auto-update files
}

Usage Examples:

import { autoUpdater } from "electron-updater";

// Simple generic server setup
autoUpdater.setFeedURL("https://updates.myapp.com");

// Advanced generic server configuration
autoUpdater.setFeedURL({
  provider: "generic",
  url: "https://updates.myapp.com",
  channel: "beta",
  useMultipleRangeRequest: true
});

// Required server file structure:
// https://updates.myapp.com/
//   ├── latest.yml              (Windows/Linux stable)
//   ├── latest-mac.yml          (macOS stable)
//   ├── beta.yml                (Windows/Linux beta)
//   ├── beta-mac.yml            (macOS beta)
//   └── files/
//       ├── myapp-1.0.0-setup.exe
//       ├── myapp-1.0.0.dmg
//       └── myapp-1.0.0.AppImage

// Example latest.yml content:
// version: 1.0.0
// files:
//   - url: myapp-1.0.0-setup.exe
//     sha512: abc123...
//     size: 50000000
// releaseDate: '2023-10-01T12:00:00.000Z'

GitHub Configuration

Configuration for GitHub releases as update source.

/**
 * GitHub releases provider configuration
 */
interface GithubOptions extends PublishConfiguration {
  provider: "github";
  owner: string;                        // Repository owner/organization
  repo: string;                         // Repository name
  token?: string;                       // GitHub access token (required for private repos)
  private?: boolean;                    // Whether repository is private
  releaseType?: "draft" | "prerelease" | "release"; // Types of releases to include
  publishAutoUpdate?: boolean;          // Publish auto-update files to releases
  vPrefixedTagName?: boolean;          // Whether tag names are prefixed with 'v'
}

Usage Examples:

import { autoUpdater } from "electron-updater";

// Public GitHub repository
autoUpdater.setFeedURL({
  provider: "github",
  owner: "myorg",
  repo: "myapp"
});

// Private repository with authentication
autoUpdater.setFeedURL({
  provider: "github",
  owner: "myorg", 
  repo: "private-app",
  token: process.env.GITHUB_TOKEN,
  private: true
});

// Include pre-release versions
autoUpdater.setFeedURL({
  provider: "github",
  owner: "myorg",
  repo: "myapp",
  releaseType: "prerelease"
});

autoUpdater.allowPrerelease = true;
autoUpdater.fullChangelog = true; // Get complete changelog

// Custom GitHub Enterprise server
autoUpdater.setFeedURL({
  provider: "github",
  owner: "myorg",
  repo: "myapp",
  token: process.env.GHE_TOKEN,
  // Note: GitHub Enterprise requires custom provider implementation
});

Amazon S3 Configuration

Configuration for Amazon S3 and S3-compatible storage services.

/**
 * Amazon S3 provider configuration
 */
interface S3Options extends PublishConfiguration {
  provider: "s3";
  bucket: string;                       // S3 bucket name
  region?: string;                      // AWS region (default: us-east-1)
  acl?: string;                         // Access control list (default: public-read)
  storageClass?: string;                // Storage class (default: STANDARD)
  encryption?: string;                  // Server-side encryption
  endpoint?: string;                    // Custom S3 endpoint for S3-compatible services
  channel?: string;                     // Update channel
  path?: string;                        // Path prefix within bucket
}

Usage Examples:

import { autoUpdater } from "electron-updater";

// Standard S3 configuration
autoUpdater.setFeedURL({
  provider: "s3",
  bucket: "myapp-updates",
  region: "us-west-2"
});

// S3-compatible service (MinIO, DigitalOcean Spaces, etc.)
autoUpdater.setFeedURL({
  provider: "s3",
  bucket: "myapp-updates",
  endpoint: "https://sfo3.digitaloceanspaces.com",
  region: "sfo3"
});

// With custom path and channel
autoUpdater.setFeedURL({
  provider: "s3",
  bucket: "myapp-updates",
  region: "eu-west-1",
  path: "releases/desktop",
  channel: "beta"
});

DigitalOcean Spaces Configuration

Configuration for DigitalOcean Spaces storage service.

/**
 * DigitalOcean Spaces provider configuration
 */
interface SpacesOptions extends PublishConfiguration {
  provider: "spaces";
  name: string;                         // Spaces name
  region: string;                       // Spaces region
  path?: string;                        // Path prefix within space
  acl?: string;                         // Access control list
  channel?: string;                     // Update channel
}

Usage Examples:

import { autoUpdater } from "electron-updater";

// DigitalOcean Spaces setup
autoUpdater.setFeedURL({
  provider: "spaces",
  name: "myapp-cdn",
  region: "nyc3",
  path: "updates"
});

Bitbucket Configuration

Configuration for Bitbucket downloads as update source.

/**
 * Bitbucket downloads provider configuration
 */
interface BitbucketOptions extends PublishConfiguration {
  provider: "bitbucket";
  owner: string;                        // Repository owner
  slug: string;                         // Repository slug (name)
  token?: string;                       // Bitbucket access token
  channel?: string;                     // Update channel
  username?: string;                    // Username for authentication
  password?: string;                    // Password for authentication
}

Usage Examples:

import { autoUpdater } from "electron-updater";

// Public Bitbucket repository
autoUpdater.setFeedURL({
  provider: "bitbucket",
  owner: "myteam",
  slug: "myapp"
});

// Private repository with token authentication
autoUpdater.setFeedURL({
  provider: "bitbucket",
  owner: "myteam",
  slug: "private-app", 
  token: process.env.BITBUCKET_TOKEN
});

// Username/password authentication
autoUpdater.setFeedURL({
  provider: "bitbucket",
  owner: "myteam",
  slug: "myapp",
  username: process.env.BITBUCKET_USERNAME,
  password: process.env.BITBUCKET_PASSWORD
});

GitLab Configuration

Configuration for GitLab releases as update source.

/**
 * GitLab releases provider configuration
 */
interface GitlabOptions extends PublishConfiguration {
  provider: "gitlab";
  owner: string;                        // Project owner/namespace
  slug: string;                         // Repository name
  host?: string;                        // GitLab instance URL (default: gitlab.com)
  token?: string;                       // GitLab access token
  channel?: string;                     // Update channel
  publishAutoUpdate?: boolean;          // Publish auto-update files
}

Usage Examples:

import { autoUpdater } from "electron-updater";

// GitLab.com public repository
autoUpdater.setFeedURL({
  provider: "gitlab",
  owner: "mygroup",
  slug: "myapp"
});

// Self-hosted GitLab instance
autoUpdater.setFeedURL({
  provider: "gitlab",
  owner: "mygroup",
  slug: "myapp",
  host: "gitlab.mycompany.com",
  token: process.env.GITLAB_TOKEN
});

// Private GitLab.com repository
autoUpdater.setFeedURL({
  provider: "gitlab",
  owner: "mygroup",
  slug: "private-app",
  token: process.env.GITLAB_TOKEN
});

Keygen Configuration

Configuration for Keygen.sh software licensing platform.

/**
 * Keygen.sh provider configuration
 */
interface KeygenOptions extends PublishConfiguration {
  provider: "keygen";
  account: string;                      // Keygen account identifier
  product: string;                      // Product identifier
  channel?: string;                     // Release channel
  platform?: string;                   // Target platform override
  publishAutoUpdate?: boolean;          // Publish auto-update files
}

Usage Examples:

import { autoUpdater } from "electron-updater";

// Keygen-hosted updates with licensing
autoUpdater.setFeedURL({
  provider: "keygen",
  account: "my-software-company",
  product: "my-premium-app",
  channel: "stable"
});

// Platform-specific configuration
autoUpdater.setFeedURL({
  provider: "keygen",
  account: "my-company",
  product: "cross-platform-app",
  platform: process.platform
});

Custom Provider Configuration

Configuration for custom provider implementations.

/**
 * Custom provider configuration
 */
interface CustomOptions extends PublishConfiguration {
  provider: "custom";
  updateProvider: any;                  // Custom provider class or instance
  [key: string]: any;                   // Additional custom options
}

Usage Examples:

import { autoUpdater, Provider } from "electron-updater";

// Custom provider implementation
class MyCustomProvider extends Provider {
  async getLatestVersion() {
    // Custom logic to fetch update information
    const response = await fetch("https://api.myapp.com/updates");
    return response.json();
  }

  resolveFiles(updateInfo) {
    // Custom logic to resolve download URLs
    return updateInfo.files.map(file => ({
      url: new URL(file.url, "https://downloads.myapp.com"),
      info: file
    }));
  }
}

// Use custom provider
autoUpdater.setFeedURL({
  provider: "custom",
  updateProvider: MyCustomProvider
});

Advanced Configuration Patterns

Complex configuration scenarios and patterns.

/**
 * Environment-specific configuration
 */
interface EnvironmentConfig {
  development: AllPublishOptions;
  staging: AllPublishOptions;
  production: AllPublishOptions;
}

/**
 * Multi-channel configuration
 */
interface ChannelConfig {
  [channel: string]: AllPublishOptions;
}

Usage Examples:

import { autoUpdater } from "electron-updater";

// Environment-based configuration
const configs: EnvironmentConfig = {
  development: {
    provider: "generic",
    url: "http://localhost:3000/updates"
  },
  staging: {
    provider: "s3",
    bucket: "myapp-staging-updates",
    region: "us-east-1"
  },
  production: {
    provider: "github",
    owner: "myorg",
    repo: "myapp"
  }
};

const environment = process.env.NODE_ENV || "development";
autoUpdater.setFeedURL(configs[environment]);

// Multi-channel configuration
const channelConfigs: ChannelConfig = {
  stable: {
    provider: "github",
    owner: "myorg",
    repo: "myapp",
    releaseType: "release"
  },
  beta: {
    provider: "github", 
    owner: "myorg",
    repo: "myapp",
    releaseType: "prerelease"
  },
  alpha: {
    provider: "s3",
    bucket: "myapp-alpha-builds",
    region: "us-west-2"
  }
};

// Set channel based on user preference
const userChannel = getUserPreferredChannel();
autoUpdater.setFeedURL(channelConfigs[userChannel]);
autoUpdater.channel = userChannel;

// Dynamic configuration switching
function switchToChannel(channel: string) {
  if (channelConfigs[channel]) {
    autoUpdater.setFeedURL(channelConfigs[channel]);
    autoUpdater.channel = channel;
    autoUpdater.allowPrerelease = channel !== "stable";
  }
}

// Request headers for authentication
autoUpdater.requestHeaders = {
  "Authorization": `Bearer ${getApiToken()}`,
  "X-Client-Version": require("../package.json").version,
  "X-Platform": process.platform,
  "X-Arch": process.arch
};

// Custom verification and rollout logic
autoUpdater.isUpdateSupported = async (updateInfo) => {
  // Check system requirements
  const minVersion = updateInfo.minimumSystemVersion;
  if (minVersion && !semver.gte(os.release(), minVersion)) {
    return false;
  }
  
  // Check available disk space
  const requiredSpace = updateInfo.files.reduce((sum, file) => sum + (file.size || 0), 0);
  const availableSpace = await getAvailableDiskSpace();
  return availableSpace > requiredSpace * 1.5; // 50% buffer
};

autoUpdater.isUserWithinRollout = async (updateInfo) => {
  const rolloutPercentage = updateInfo.stagingPercentage || 100;
  const userId = await getUserId();
  const userHash = hash(userId) % 100;
  return userHash < rolloutPercentage;
};

Configuration Validation

Helper functions and patterns for validating configuration.

// Configuration validation helper
function validateConfig(config: AllPublishOptions): boolean {
  if (typeof config === "string") {
    return isValidUrl(config);
  }
  
  switch (config.provider) {
    case "github":
      return !!(config as GithubOptions).owner && !!(config as GithubOptions).repo;
    case "s3":
      return !!(config as S3Options).bucket;
    case "generic":
      return !!(config as GenericServerOptions).url;
    default:
      return false;
  }
}

// Environment-specific setup
function setupUpdater() {
  const config = getConfigForEnvironment();
  
  if (!validateConfig(config)) {
    console.error("Invalid updater configuration");
    return;
  }
  
  autoUpdater.setFeedURL(config);
  
  // Configure behavior based on environment
  if (process.env.NODE_ENV === "development") {
    autoUpdater.forceDevUpdateConfig = true;
    autoUpdater.logger = console;
  } else {
    autoUpdater.logger = require("electron-log");
  }
}