-
Notifications
You must be signed in to change notification settings - Fork 56
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
Change config file format from YAML to TOML #57
Conversation
…ding environment variables in the config file
@Svenskunganka Have you recently tested this after all the latest updates? I like the idea conceptually of matching the TOML format that rust already uses for cargo, but will need to thoroughly test this to ensure there is no breakage. I am still getting the hang of this codebase, so I appreciate your patience! @Kogia-sima, @jdrouet what do you think? |
@vthg2themax I agree with you about the toml format. |
@jdrouet @Svenskunganka I am looking at it, and it looks good, however I want to run the files locally to test it. Aside from manually copying the changes to my local copy, do you know of a way in git or something to get these changes? Thanks for any help you can offer! |
Something like this should do it git remote add sven https://github.com/Svenskunganka/sailfish.git
git fetch sven
git checkout sven toml |
@jdrouet Thanks! I thought I would have to use the GitHub desktop client on a windows box. |
@jdrouet After running cargo update, and cargo build, I'm getting errors while compiling it. I'll try to see what else I can come up with. |
@Svenskunganka @jdrouet I think perhaps the original person offering this change is not available to pull the latest changes into their branch? If so, perhaps manually copying the changes would be the best. It looks like they are using an older copy of sailfish. |
@vthg2themax you can push the branch to your own fork and merge master into it 😉 |
@jdrouet Well, here goes. I kind of think that the Merge Pull request button should not break anything in master, but if it does, I'll figure it out. Thank you for your help! |
Hey guys, sorry for not getting back earlier. Cool that this is now merged! Some thing to note that we might need to look into before publishing a new version: Currently, after expanding environment variables - the path is not resolved, e.g You can see more of this in the tests I added. Resolving the template: sailfish/sailfish-compiler/src/procmacro.rs Lines 85 to 104 in ef48042
Errors out here: sailfish/sailfish-compiler/src/procmacro.rs Lines 196 to 208 in ef48042
The error here could be improved to tell the user where the compiler has tried looking for the template but couldn't find it, which will help users find out if their Finally, this is a breaking change and probably warrants a 0.4 version bump before release. |
Some things to note:
#[serde(deny_unknown_fields)]
from the structs.${VARIABLE}
/${variable}
format, not$VARIABLE
as that's going to limit users via case-sensitivity:/path/to/$VARIABLETemplates
won't work while/path/to/${VARIABLE}Templates
will.std::env
has:${VaRiAbLe} != ${VARIABLE} != ${variable}
Things I'm unsure about:
How to add more tests than what was already available as I suspect I'd have to mark most ofConfigFile
aspub
to access fromsailfish-tests
crate (and add some more methods)How the error macros & conversions works. I think I've managed to get the errors descriptive. E.g:
Hopefully this time I've managed to not miss something like I did in my last PR.
Closes #44
Closes #42
Closes #38