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: System helpers #858

Conversation

Meldiron
Copy link
Contributor

@Meldiron Meldiron commented Nov 5, 2022

Closes #849

Technical implementation details

  • Add env-prefix parameter into CLI
  • Add env-prefix settings into Electron app
  • Add System helpers
  • Introduce env system helper
  • Discuss more useful system helpers
  • Manual QA

Checklist

  • data migration added (@mockoon/commons)
  • data migration automated tests added (@mockoon/commons)
  • CLI automated tests added (@mockoon/cli)
  • desktop automated tests added (@mockoon/desktop)

@Meldiron
Copy link
Contributor Author

Meldiron commented Nov 5, 2022

Managed to get working flow with config:

"{\"var\": \"{{'env' 'MOCKOON_SOME_VAR' 'SomeDefaultValue'}}\"}",

Running command:

MOCKOON_SOME_VAR=hello123 ./packages/cli/bin/run start -d mockoon.json -p 9000 --daemon-off

And result:

CleanShot 2022-11-05 at 09 41 03@2x

Also tested default (when a variable is not set), wrong prefix (non-starting with MOCKOON_), and custom prefix. All works expected.

@255kb 255kb changed the base branch from main to feature/849-env-vars-support February 20, 2024 07:55
@255kb 255kb marked this pull request as ready for review February 20, 2024 08:57
@255kb 255kb self-requested a review as a code owner February 20, 2024 08:57
@255kb 255kb deleted the branch mockoon:feature/849-env-vars-support February 20, 2024 09:01
@255kb 255kb closed this Feb 20, 2024
255kb added a commit that referenced this pull request Feb 20, 2024
Co-authored-by: Matej Bačo <[email protected]>
@255kb 255kb mentioned this pull request Feb 20, 2024
9 tasks
@255kb
Copy link
Member

255kb commented Feb 20, 2024

@Meldiron After discussion, I'm taking this PR from here.
I had to resolve conflicts and merge locally as the CLI code changed massively.
I opened a new PR #1314

255kb added a commit that referenced this pull request Feb 21, 2024
Co-authored-by: Matej Bačo <[email protected]>
255kb added a commit that referenced this pull request Feb 21, 2024
* Merge #858 PR and fix conflicts

Co-authored-by: Matej Bačo <[email protected]>

* Finalize env vars feature

Add tests in commons-server and CLI
Add serverless option
Add desktop setting
Closes #849

---------

Co-authored-by: Matej Bačo <[email protected]>
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.

Feat: Environment variables in templating
2 participants