Skip to content

feat: prioritize connections from env#297

Merged
nazarfil merged 4 commits into
mainfrom
feat/use-local-connections
Aug 4, 2025
Merged

feat: prioritize connections from env#297
nazarfil merged 4 commits into
mainfrom
feat/use-local-connections

Conversation

@yannforget

@yannforget yannforget commented Aug 4, 2025

Copy link
Copy Markdown
Member

Now that we can provide environment variables through workspace.yaml, we can access remote resources if we set HEXA_SERVER_URL and HEXA_TOKEN. This includes connections.

However users running pipelines locally will lose access to mock connections set in workspace.yaml if they do that - as the SDK is detecting the availability of HEXA_SERVER_URL and skip local stuff as a result (including parsing connections from env instead of graphql).

The PR prioritizes env variables instead of the ones returned by the API.

Changes

_connected is True if HEXA_SERVER_URL is set (not changed)

Before:

  • If _connected, get connection from API.
    • If found, return connection
    • If not found, raise error
  • If not _connected, get connection from env variables
    • If found, return connection
    • If not found, raise error

After:

  • Get connection from env variables
  • If _connected and not found, get connection from env variables
  • If found, return connection
  • If not found, raise error

How/what to test

Example workspace.yaml

files:
  path: ./workspace
connections:
  strapi-local:
    type: custom
    url: "http://172.17.0.1:1337"
    api_token: "<api_token>"
env:
  HEXA_SERVER_URL: https://api.openhexa.org/
  HEXA_TOKEN: <token>
  HEXA_WORKSPACE: <workspace_slug>

@nazarfil nazarfil left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I have added a commit to use newly added OpenHexaClient and changed test mocks accordingly.

@nazarfil nazarfil merged commit f3ed79a into main Aug 4, 2025
4 checks passed
@nazarfil nazarfil deleted the feat/use-local-connections branch August 4, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants