How to Configure Environment Variables for Palmier Pro: Runtime and Build Setup

Palmier Pro uses environment variables to configure the Anthropic AI client, optional SigLIP-2 model paths, and release build scripts, reading them from .env files via ProcessInfo.processInfo.environment in Swift and source commands in Bash.

The palmier-io/palmier-pro repository relies on a small set of environment variables to bridge configuration between runtime behavior and automated build pipelines. Understanding how to set these variables ensures both the AI assistant functionality and the release signing process operate correctly.

Runtime Environment Variables

These variables control application behavior when running the Swift codebase from Sources/PalmierPro/.

ANTHROPIC_API_KEY

The AnthropicClient.swift file located at Sources/PalmierPro/Agent/Clients/AnthropicClient.swift retrieves this API key using ProcessInfo.processInfo.environment["ANTHROPIC_API_KEY"]. This authenticates requests to the Anthropic LLM service that powers the built-in AI assistant. If the variable is absent or empty, the client disables itself gracefully.

// Sources/PalmierPro/Agent/Clients/AnthropicClient.swift
if let env = ProcessInfo.processInfo.environment["ANTHROPIC_API_KEY"],
   !env.isEmpty {
    return env          // use the provided key
}

SIGLIP2_BUILD

This optional variable specifies the path to SigLIP-2 model assets used by the visual-search subsystem. The test harness in Tests/PalmierProTests/Search/VisualEmbedderParityTests.swift reads ProcessInfo.processInfo.environment["SIGLIP2_BUILD"], defaulting to a relative "build" directory if unset.

// Tests/PalmierProTests/Search/VisualEmbedderParityTests.swift
let modelPath = ProcessInfo.processInfo.environment["SIGLIP2_BUILD"] ?? "build"
let modelURL = URL(fileURLWithPath: modelPath)

Build-Time Environment Variables

The scripts/release.sh script consumes these variables during the release pipeline. They are optional for local development but required for distribution builds.

Variable Purpose Example Value
VERSION Release version string 1.2.3
NEW_BUILD Incremental build number 20240621
PUBDATE ISO-8601 publication date 2024-06-21
LENGTH Release notes video length in seconds 120
SIGNATURE Code-signing signature abcdef1234567890

Creating the .env Configuration File

Create a .env file in the repository root (the same directory containing Package.swift). For release builds, create .env.prod instead; the scripts/bundle.sh script automatically prefers this file when CONFIG=release.

Example .env content:


# Runtime keys

ANTHROPIC_API_KEY=sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# Optional model path for visual search (used in tests)

SIGLIP2_BUILD=../models/siglip2/build

# Build-script help (only needed for release pipeline)

VERSION=1.0.0
NEW_BUILD=20240621
PUBDATE=2024-06-21
LENGTH=120
SIGNATURE=abcdef1234567890

How Build Scripts Load Environment Variables

The scripts/bundle.sh script handles environment file selection logic before sourcing the variables. It checks for a release configuration and falls back to .env if .env.prod is unavailable.


# scripts/bundle.sh – selecting which .env file to load

ENV_FILE=".env"
if [ "$CONFIG" = "release" ] && [ -f "$ROOT/.env.prod" ]; then
  ENV_FILE=".env.prod"
fi
source "$ROOT/$ENV_FILE"

Accessing Variables in Swift Source Code

The Swift runtime reads environment variables directly through ProcessInfo without requiring external configuration libraries. This applies to both the main application target and the test suite.

When the AnthropicClient.swift initializes, it checks for the key in the process environment dictionary. Similarly, visual embedding tests in VisualEmbedderParityTests.swift resolve model paths through the same mechanism.

Summary

  • Store runtime configuration (ANTHROPIC_API_KEY, SIGLIP2_BUILD) in a .env file at the repository root
  • Use .env.prod for release builds; the scripts/bundle.sh script selects it automatically when CONFIG=release
  • Swift code accesses values via ProcessInfo.processInfo.environment["VARIABLE_NAME"]
  • Bash scripts source the file using source "$ENV_FILE" before executing commands
  • Build-time variables (VERSION, NEW_BUILD, PUBDATE, LENGTH, SIGNATURE) are only required for the release pipeline in scripts/release.sh

Frequently Asked Questions

What happens if ANTHROPIC_API_KEY is not set?

If the variable is absent or empty, AnthropicClient.swift falls back to default behavior and disables the AI assistant features. The application continues to run, but Anthropic LLM integration will be unavailable.

Can I use a different filename instead of .env?

The scripts/bundle.sh script specifically looks for .env by default, or .env.prod when CONFIG=release is set. To use custom filenames, you would need to modify the ENV_FILE variable assignment in the bundle script.

Are environment variables required for local development?

No. While ANTHROPIC_API_KEY enables AI features, the application runs without it. Build-time variables like VERSION and SIGNATURE are only necessary when executing scripts/release.sh for distribution; local builds in Xcode do not require them.

How does Palmier Pro handle the SIGLIP2_BUILD path?

The test suite in Tests/PalmierProTests/Search/VisualEmbedderParityTests.swift reads the variable via ProcessInfo.processInfo.environment and defaults to a relative "build" directory if the environment variable is undefined, allowing tests to run without explicit configuration.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →