diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 205578c68..764f6fcba 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,11 @@ # @openfn/cli +## 1.34.2 + +### Patch Changes + +- 3918358: Override config.endpoint with one from openfn.yaml + ## 1.34.1 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index af316d9f2..7f9b29d32 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@openfn/cli", - "version": "1.34.1", + "version": "1.34.2", "description": "CLI devtools for the OpenFn toolchain", "engines": { "node": ">=18", diff --git a/packages/cli/src/deploy/handler.ts b/packages/cli/src/deploy/handler.ts index a9700ef85..cd27c3349 100644 --- a/packages/cli/src/deploy/handler.ts +++ b/packages/cli/src/deploy/handler.ts @@ -10,6 +10,8 @@ import { DeployOptions } from './command'; import * as beta from '../projects/deploy'; import path from 'node:path'; import { fileExists } from '../util/file-exists'; +import { yamlToJson } from '@openfn/project'; +import fs from 'node:fs/promises'; export type DeployFn = typeof deploy; @@ -39,6 +41,12 @@ async function deployHandler( 'openfn.yaml' ); if (await fileExists(v2ConfigPath)) { + // override endpoint with one from openfn.yaml + const config = yamlToJson(await fs.readFile(v2ConfigPath, 'utf-8')); + if (config?.project?.endpoint) { + config.endpoint = config.project.endpoint; + } + logger.always( 'Detected openfn.yaml file - switching to v2 deploy (openfn project deploy)' ); diff --git a/packages/cli/src/pull/handler.ts b/packages/cli/src/pull/handler.ts index b8d0ae891..15220d724 100644 --- a/packages/cli/src/pull/handler.ts +++ b/packages/cli/src/pull/handler.ts @@ -12,6 +12,7 @@ import type { Logger } from '../util/logger'; import { PullOptions } from '../pull/command'; import beta from '../projects/pull'; import { fileExists } from '../util/file-exists'; +import { yamlToJson } from '@openfn/project'; async function pullHandler(options: PullOptions, logger: Logger) { if (options.beta) { @@ -26,6 +27,12 @@ async function pullHandler(options: PullOptions, logger: Logger) { 'openfn.yaml' ); if (await fileExists(v2ConfigPath)) { + // override endpoint with one from openfn.yaml + const config = yamlToJson(await fs.readFile(v2ConfigPath, 'utf-8')); + if (config?.project?.endpoint) { + config.endpoint = config.project.endpoint; + } + logger.always( 'Detected openfn.yaml file - switching to v2 pull (openfn project pull)' );