@arizeai/phoenix-config

中文文档
0.5.1发布于 2026/10/22Apache-2.0TypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 27万

central configuration for Phoenix

原始使用文档
文档目录10 节
  1. Installation
  2. Environment Variables
  3. Credential File Discovery ( .env.phoenix )
  4. Usage
  5. Reading All Configuration
  6. Resolving the Project Name
  7. Reading Individual Values
  8. Using Constants
  9. Types
  10. Community

Arize Phoenix logo
@arizeai/phoenix-config

NPM Version Documentation

Shared configuration parsing utilities used across @arizeai/phoenix-otel and @arizeai/phoenix-client. Provides typed helpers for reading Phoenix environment variables.

Installation

npm install @arizeai/phoenix-config

Environment Variables

VariableConstantDescription
PHOENIX_ENDPOINTENV_PHOENIX_ENDPOINTPhoenix base URL for API access
PHOENIX_HOSTENV_PHOENIX_HOSTPhoenix server bind host; read only as a legacy fallback for the API base URL
PHOENIX_API_KEYENV_PHOENIX_API_KEYAPI key for Phoenix authentication
PHOENIX_CLIENT_HEADERSENV_PHOENIX_CLIENT_HEADERSJSON-encoded custom headers for client requests
PHOENIX_COLLECTOR_ENDPOINTENV_PHOENIX_COLLECTOR_ENDPOINTOTel collector endpoint URL
PHOENIX_PORTENV_PHOENIX_PORTPhoenix HTTP port (integer)
PHOENIX_GRPC_PORTENV_PHOENIX_GRPC_PORTPhoenix gRPC port for OpenTelemetry (integer)
PHOENIX_PROJECTENV_PHOENIX_PROJECTDefault project name for project-scoped operations (canonical)
PHOENIX_PROJECT_NAMEENV_PHOENIX_PROJECT_NAMESupported alias for PHOENIX_PROJECT
PHOENIX_LOG_LEVELENV_PHOENIX_LOG_LEVELLog verbosity: debug, info, warn, error, or silent
PHOENIX_DISCOVER_CONFIGENV_PHOENIX_DISCOVER_CONFIGSet to false to disable .env.phoenix file discovery

Credential File Discovery (.env.phoenix)

When a Phoenix setting is not set in the process environment, the helpers look for a .env.phoenix file in the current working directory — walking up toward the filesystem root and stopping at the first match — and read PHOENIX_-prefixed keys from it (dotenv format):

Add .env.phoenix to your repository's ignore rules before storing credentials in this file (the Phoenix repository already ignores it).

# .env.phoenix
PHOENIX_COLLECTOR_ENDPOINT=http://localhost:6006
PHOENIX_API_KEY=your-api-key

Process environment variables always take precedence — the file never overrides anything already set — and keys without a PHOENIX_ prefix are ignored. Related settings are resolved as groups: when any credential (PHOENIX_API_KEY, PHOENIX_CLIENT_HEADERS) is set in the process environment, the file is ignored for the whole credential group, so process and file credentials are never mixed. Set PHOENIX_DISCOVER_CONFIG=false to disable discovery entirely.

An endpoint from .env.phoenix can still be combined with credentials supplied explicitly or by the process environment. Consumers emit a one-time warning in that case naming the credential source, endpoint variable, and discovered file; credential values are never logged. Source-aware consumers should use getStrFromEnvironmentWithSource() and getCredentialsFromEnvironmentWithSource() rather than reconstructing the source tier themselves.

Discovery results are cached per working directory for the lifetime of the process (including the absence of a file). Long-running processes that create the file after the first configuration lookup can call clearEnvFileCache() to re-discover it.

Usage

Reading All Configuration

import { getEnvironmentConfig } from "@arizeai/phoenix-config";

const config = getEnvironmentConfig();
// Returns a typed object with all recognized Phoenix env vars:
// {
//   PHOENIX_HOST: "http://localhost:6006",
//   PHOENIX_API_KEY: "my-key",
//   PHOENIX_CLIENT_HEADERS: { "X-Custom": "value" },
//   PHOENIX_COLLECTOR_ENDPOINT: "http://localhost:6006",
//   PHOENIX_PORT: 6006,
//   PHOENIX_GRPC_PORT: 4317,
//   PHOENIX_LOG_LEVEL: "info",
//   PHOENIX_PROJECT: "my-project",
// }

Resolving the Project Name

PHOENIX_PROJECT is the canonical project-name variable; PHOENIX_PROJECT_NAME is a supported alias. Use getProjectFromEnvironment() to resolve the pair with the correct precedence (PHOENIX_PROJECT wins; a one-time warning is emitted if both are set to conflicting values):

import { getProjectFromEnvironment } from "@arizeai/phoenix-config";

const project = getProjectFromEnvironment();
// Reads PHOENIX_PROJECT, then PHOENIX_PROJECT_NAME, or undefined if neither is set

Reading Individual Values

import {
  getStrFromEnvironment,
  getIntFromEnvironment,
  getHeadersFromEnvironment,
  ENV_PHOENIX_ENDPOINT,
  ENV_PHOENIX_PORT,
  ENV_PHOENIX_CLIENT_HEADERS,
} from "@arizeai/phoenix-config";

// Read a string environment variable
const endpoint = getStrFromEnvironment(ENV_PHOENIX_ENDPOINT);
// Returns "http://localhost:6006" or undefined

// Read an integer environment variable
const port = getIntFromEnvironment(ENV_PHOENIX_PORT);
// Returns 6006 or undefined

// Read and parse a JSON-encoded headers object
const headers = getHeadersFromEnvironment(ENV_PHOENIX_CLIENT_HEADERS);
// Returns { "Authorization": "Bearer token" } or undefined

Using Constants

import {
  ENV_PHOENIX_ENDPOINT,
  ENV_PHOENIX_HOST,
  ENV_PHOENIX_API_KEY,
  ENV_PHOENIX_CLIENT_HEADERS,
  ENV_PHOENIX_COLLECTOR_ENDPOINT,
  ENV_PHOENIX_PORT,
  ENV_PHOENIX_GRPC_PORT,
  ENV_PHOENIX_PROJECT_NAME,
  ENV_PHOENIX_PROJECT,
  ENV_PHOENIX_LOG_LEVEL,
} from "@arizeai/phoenix-config";

// Use constants instead of raw strings to avoid typos
const apiKey = process.env[ENV_PHOENIX_API_KEY];

Types

import type { EnvironmentConfig } from "@arizeai/phoenix-config";
// Inferred return type of getEnvironmentConfig()

Community

Join our community to connect with thousands of AI builders:

版本与发布记录

@arizeai/phoenix-config 共发布 11 个版本,首次发布于 2025/12/19;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.5.1latest2026/10/2217 天前
0.5.02026/08/082 个月前
0.4.02026/07/153 个月前
0.3.02026/07/113 个月前
0.2.02026/07/093 个月前
0.1.42026/05/046 个月前

关于 @arizeai/phoenix-config 的常见问题

@arizeai/phoenix-config 是什么?

central configuration for Phoenix

如何安装 @arizeai/phoenix-config?

在项目目录运行 npm install @arizeai/phoenix-config,或使用 pnpm add / yarn add / bun add。

@arizeai/phoenix-config 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@arizeai/phoenix-config 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@arizeai/phoenix-config 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@arizeai/phoenix-config 可以商用吗?

@arizeai/phoenix-config 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@arizeai/phoenix-config 的下载量有多少?

根据 npm 官方下载统计,@arizeai/phoenix-config 在 2026/10/07 – 2026/11/05 这 30 天内被下载 269,697 次,日均约 8,990 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@arizeai/phoenix-config 还在维护吗?

最新版本 0.5.1 发布于 2026/10/22(17 天前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2025/12/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。