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

feat(cli): run command watch mode #2353

Merged
merged 7 commits into from
Sep 10, 2024
Merged

feat(cli): run command watch mode #2353

merged 7 commits into from
Sep 10, 2024

Conversation

DanielHougaard
Copy link
Contributor

Description 📣

This PR aims to add support for secret watching. The user will now be able to pass a --watch flag to the infisical run command. When the watch flag is passed, Infisical will automatically reload the command passed to infisical run.

New flow example

  1. User runs infisical run --watch --comand="while true; do printenv; sleep 500000; done". (Both --command and -- supports the new watch flag)
    • At first this acts exactly like it always has, and prints the environment to the console and hangs until interrupted.
  2. The user now changes a secret in Infisical.
  3. At some point within the next 10 seconds (due to polling), the application will detect a change in the Infisical secrets, and then trigger a reload of the application.
  4. The application reloads and the new secrets are loaded into the application.

This is especially useful in local development setups, where the user usually would have to manually restart the entire process for the new secrets to load in. This implementation streamlines everything and in a sense acts like Nodemon acts when detecting changes in a Node.js project.

This can also be used in production environments where you'd want to reload an application when secret changes happen in Infisical.

Type ✨

  • Bug fix
  • New feature
  • Breaking change
  • Documentation

@DanielHougaard DanielHougaard self-assigned this Aug 29, 2024
Copy link
Collaborator

@maidul98 maidul98 left a comment

Choose a reason for hiding this comment

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

Left feedback via slack

cli/packages/cmd/run.go Outdated Show resolved Hide resolved
cli/packages/cmd/run.go Outdated Show resolved Hide resolved
cli/packages/cmd/run.go Outdated Show resolved Hide resolved
cli/packages/cmd/run.go Outdated Show resolved Hide resolved
cli/packages/cmd/run.go Outdated Show resolved Hide resolved
cli/packages/cmd/run.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@maidul98 maidul98 left a comment

Choose a reason for hiding this comment

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

Otherwise, the refactor lgtm

cli/packages/cmd/run.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@maidul98 maidul98 left a comment

Choose a reason for hiding this comment

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

One last comment and should be ready for merge

cli/packages/cmd/run.go Show resolved Hide resolved
@maidul98 maidul98 merged commit a549c8b into main Sep 10, 2024
3 checks passed
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.

3 participants