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:
+10
-3
@@ -193,10 +193,17 @@ export function createStreamCommandCode(deps: CoreDependencies) {
|
||||
const stream = deps.createStream()
|
||||
|
||||
async function run() {
|
||||
// OMP may pass the env-var name "COMMANDCODE_API_KEY" as the apiKey
|
||||
// value instead of resolving it. Filter out this specific string.
|
||||
// OMP may pass the legacy env-var name "COMMANDCODE_API_KEY" (old pi)
|
||||
// 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 =
|
||||
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 =
|
||||
hostKey ??
|
||||
|
||||
Reference in New Issue
Block a user