fix: resolve deprecation warning for apiKey value

Use the explicit $COMMANDCODE_API_KEY environment variable reference expected by newer pi versions while keeping compatibility with the legacy placeholder handling.
This commit is contained in:
PlumJam
2026-06-16 14:08:11 +02:00
committed by GitHub
parent f06982fc94
commit 88d8706234
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ export default async function (pi: ExtensionAPI) {
pi.registerProvider("commandcode", { pi.registerProvider("commandcode", {
name: "Command Code", name: "Command Code",
baseUrl: API_BASE, baseUrl: API_BASE,
apiKey: "COMMANDCODE_API_KEY", apiKey: "$COMMANDCODE_API_KEY",
authHeader: true, authHeader: true,
api: "commandcode-custom", api: "commandcode-custom",
streamSimple: streamCommandCode, streamSimple: streamCommandCode,
+10 -3
View File
@@ -193,10 +193,17 @@ export function createStreamCommandCode(deps: CoreDependencies) {
const stream = deps.createStream() const stream = deps.createStream()
async function run() { async function run() {
// OMP may pass the env-var name "COMMANDCODE_API_KEY" as the apiKey // OMP may pass the legacy env-var name "COMMANDCODE_API_KEY" (old pi)
// value instead of resolving it. Filter out this specific string. // or "$COMMANDCODE_API_KEY" (new pi) as the apiKey value instead of
// resolving it. Filter out these specific strings.
const LEGACY_API_KEY_REF = "$COMMANDCODE_API_KEY"
const OLD_API_KEY_REF = "COMMANDCODE_API_KEY"
const hostKey = const hostKey =
options?.apiKey && options.apiKey !== "COMMANDCODE_API_KEY" ? options.apiKey : undefined options?.apiKey &&
options.apiKey !== LEGACY_API_KEY_REF &&
options.apiKey !== OLD_API_KEY_REF
? options.apiKey
: undefined
const apiKey = const apiKey =
hostKey ?? hostKey ??