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

fix: mock sgx in clap args #214 #279

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

piotr-roslaniec
Copy link

@piotr-roslaniec piotr-roslaniec commented Oct 31, 2024

Resolves: #214

@dangush
Copy link
Contributor

dangush commented Nov 7, 2024

Hey @piotr-roslaniec , thanks for the PR!

I think an issue here is that mock_sgx can also be enabled by the quartz.toml file, not just the environment variable. And it's important to preserve the hierarchy so that env vars override quartz.toml values.

One solution could be to adding a read of the quartz.toml file to the validate function to match the way the config is built in main.rs. Though I'm not sure if it's good design to redundantly recreate these i/o operations in another function.

Another approach could be to change the way we're creating the Request object itself, so that we can pass the mock_sgx flag after we've correctly constructed the Config object in main.rs. I think we can safely switch away from using the try_from trait and instead make a custom function which takes our desired parameters (args.command, args.mock_sgx). This is an application rather than a library, so there isn't a great reason to be using try_from anyway.

Alternatively we could use try_from but pass in args instead of args.command, though I'm not sure that this is a better approach than just writing a new, better self-documenting function.

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.

Clap based improvements for the CLI
2 participants