Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI deploy: Fix argument precedence #882

Open
josephjclark opened this issue Feb 26, 2025 · 1 comment
Open

CLI deploy: Fix argument precedence #882

josephjclark opened this issue Feb 26, 2025 · 1 comment

Comments

@josephjclark
Copy link
Collaborator

A really really big problem in CLI deploy is that argument precedence is totally wrong.

Usually, the closest argument to the command is the one that wins. But this isn't true. And it's really annoying.

To repro (no need to set anything up remotely):

  • Set OPENFN_ENDPOINT to https://localhost:9999 (or any port where nothing is running)
  • Create a config.json:
{
  "apiKey": "abc",
  "endpoint": "https://app.openfn.org/"
}
  • Run openfn deploy pull -c config.json
  • This will fail, but note that it'll fail to call localhost:9999
  • It's basically using the wrong endpoint value

Specific issues here:

  • I should be able to pass all arguments into the CLI directly, not use config.json
  • Any args I explicitly pass must be used. For example if I do, openfn deploy --api-key $MY_OPENFN_PAT, that key must be used above what's in the env and config
  • If an arg isn't explicitly provided, we should look in config
  • Finally, if no other arg is set, we should try and read from the env.

It's super useful too, in debug logging, to track which arguments were read from where. Values can be useful too, but be careful of API keys (maybe log first 6 chars)

Note that we use --pat elsewhere in the CLI to pass an api key. idk which is better right now but we should be consistent. Or alias consistently.

@github-project-automation github-project-automation bot moved this to New Issues in v2 Feb 26, 2025
@josephjclark
Copy link
Collaborator Author

I've been tracking this in my head for ages. I have big plans for CLI deploy which will likely subsume this. But I wanted to get this logged because it's not a big fix and is probably worth doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New Issues
Development

No branches or pull requests

1 participant