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

Encapsulate configuration #62

Closed
itowlson opened this issue Feb 10, 2022 · 1 comment
Closed

Encapsulate configuration #62

itowlson opened this issue Feb 10, 2022 · 1 comment
Assignees

Comments

@itowlson
Copy link
Contributor

In the first iterations of Spin, for speed of development, the internal configuration object was a direct representation of the TOML configuration file. As we've seen in projects like WAGI and the Hippo CLI, this tends not to be sustainable: the application code ends up having to repeatedly perform the same validation/massage on the raw deserialised object, and you get alternative config flows that end up being awkwardly crobarred into that first serialisation format because so much app code is coupled to it.

It's hard to predict future configuration needs so this may be premature, but if we can make a reasonable stab at abstracting the configuration surfaced to the application from the raw serialised format, we will hopefully mitigate the effort of transition when it comes.

As an initial stab, I'd suggest:

  • Public interface of config crate should be
    • Configuration objects designed around the needs of the application as best we understand them
    • Associated functions for parsing those configuration objects from sources such as files and strings
  • Private (hopefully) config::serialisation module that deals with things like the raw on-disk TOML format

Related: https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/

@itowlson itowlson changed the title Tidy up configuration flow Encapsulate configuration Feb 10, 2022
@itowlson
Copy link
Contributor Author

This may fall naturally out of the bindling project.

@itowlson itowlson self-assigned this Feb 15, 2022
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

No branches or pull requests

2 participants