Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/src/deploy/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)'
);
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/src/pull/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Comment on lines +30 to +35
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this, redirects to the sync v2 don't pick up the endpoint coming from openfn.yaml

logger.always(
'Detected openfn.yaml file - switching to v2 pull (openfn project pull)'
);
Expand Down