-
Notifications
You must be signed in to change notification settings - Fork 37
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
💕 support for inline toml dictionaries #150
Conversation
0364738
to
f4beefa
Compare
cc: @kailan @triblondon i would love an eye from your team on this, particularly in regards to the extensions to |
Thanks for the ping @cratelyn !! This looks fantastic. I only have a small nit for the sake of consistency: rather than |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work @cratelyn! Love the tests and the general improvements you made along the way 🎉
Just wanted to leave a quick comment related to this:
In production, dictionary updates are live, so I actually depend on that functionality during development (being able to update JSON dictionaries and see the updates reflected instantly on the next request without having to restart the server). Just want to make sure we don’t remove that functionality as a result of these updates. Perhaps it was more of an unintended consequence of the previous implementation vs. by design, but it would be nice if we could preserve that behavior (even with the new format?!) |
this is done in 44e4bf6! thank you for raising this point, i agree that this is a nice behavior to maintain. 🙂 |
we'll be adding some new tests soon enough!
note that a lot of this diff is whitespace, caused by the introduction of match arms in various places. most of the logic here didn't need to change in any substantive way.
Co-Authored-By: Aaron Turon <[email protected]>
this is a change to the payload(s) of our dictionary config error variants, specifically removing dictionary names from these variants. this is a precursor to sharing logic to read the contents of a JSON dictionary both at startup, and later when a dictionary lookup is performed. at startup, these errors are propagated up into a variant that already includes the name: ```rust #[error("invalid configuration for '{name}': {err}")] InvalidDictionaryDefinition { name: String, #[source] err: DictionaryConfigError, }, ``` later on, we can similarly deduce the name of the dictionary given a handle.
this modifies our dictionary logic so that we read external files every time that a lookup is performed. this is helpful so that people do not need to restart the server every time they change a dictionary file.
61948f3
to
44e4bf6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for making the live-update adjustment 👍
Fixes #142.
🤞 should also resolve #146.
this PR implements support for inline TOML dictionaries. today, dictionaries can be configured using JSON files stored on disk. as #142 outlines, this is a smidge inconsistent with the way that we configure backends. as discussion in #146 points out, this means that running a Wasm program that accesses a dictionary entails placing files on disk.
this new inline feature allows for dictionaries to be specified inline within the
fastly.toml
file itself. here is an example configuration pulled from the test coverage in this branch:as a pleasant side-effect of this work, we are also able to refactor the dictionary deserialization and lookup logic so that we only read an external JSON file once.