Skip to content

Conversation

@mturoci
Copy link
Collaborator

@mturoci mturoci commented Jun 2, 2023

This PR adds an option to configure waved via configuration (.env) file in addition to existing cmd args and env variables.

Disclaimer

I realized Wave is pretty special-case in a sense that it uses kebabcase (dashes) for cmd args and snakecase for env vars. So I added a kebabToSnake flag that deals with this inconsistency. However, I later realized such special-casing would need to be introduced on .env plugin I also contributed, which may be a bit confusing for people since it would be the only plugin supporting the kebabToSnake flag. For this reason, I decided to include the .env plugin within Wave code.

TODO

Wave app can only be configured via env variables since we recommend running bare uvicorn instead of using ourwave run wrapper.

Uvicorn supports --env-file flag to allow configuration for the underlying (Wave app) so this seems like the way to go, needs to be tested and documented on our side.

DONE

Possible improvements

Currently, our CLI uses args for both commands and flags. We may consider changing that to Commands represent actions, Args are things and Flags are modifiers for those actions. inspired by Cobra. Unfortunately, this would need to be a breaking change.

Closes #481

@mturoci mturoci requested a review from lo5 as a code owner June 2, 2023 10:21
@mturoci mturoci requested a review from geomodular June 2, 2023 10:21
Copy link
Contributor

@geomodular geomodular left a comment

Choose a reason for hiding this comment

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

Good job Martin 👍 . I'm not really a fan of an intermediate Conf structure, but I get you cannot just use it to run the server.

@mturoci mturoci merged commit f5b3816 into master Jun 7, 2023
@mturoci mturoci deleted the feat/issue-481 branch June 7, 2023 13:34
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.

Allow configuring wave daemon using a configuration file

2 participants