-
Notifications
You must be signed in to change notification settings - Fork 220
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
Create config migration script #934
Conversation
7dad2ca
to
0cae6a2
Compare
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Allows redirecting stdout to get only the new config text. Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Signed-off-by: Andrew Richardson <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #934 +/- ##
==========================================
- Coverage 99.98% 99.97% -0.02%
==========================================
Files 299 301 +2
Lines 19478 19687 +209
==========================================
+ Hits 19475 19682 +207
- Misses 3 4 +1
- Partials 0 1 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: Andrew Richardson <[email protected]>
d07e459
to
bb3a202
Compare
Signed-off-by: Andrew Richardson <[email protected]>
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.
Looks good. Just a couple of minor suggestions for improvemnets.
ffconfig/migrate/migrations.go
Outdated
func Run(cfg []byte, fromVersion, toVersion string) (result []byte, err error) { | ||
var from, to semver.Version | ||
if fromVersion != "" { | ||
if from, err = semver.Parse(fromVersion); err != nil { |
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.
This is a minor suggestion, but we tag all of our versions as v1.x.x
. Which is technically not semver. Because we put the v
in front of it. But it's typical for Go versions. Anyway, if we could make this function optionally accept and trim a v
prefix, that might make it more user friendly for someone who routinely types out the version number by hand.
ffconfig/README.md
Outdated
|
||
### Migration | ||
|
||
Migrating a config file will remove all deprecated config for a particular version of FireFly, and replace it with |
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.
I might suggest slightly re-wording this. When I first read this (before I read the code) I wasn't sure if it would re-write my config in place. I think the phrase "remove all deprecated config" sounds a bit scary. Something along the lines of making it clear that this tool generates a copy of your config in the new structure.
Also allow "v" prefix on versions passed to the script. Signed-off-by: Andrew Richardson <[email protected]>
The goal here is to have a script that can detect configuration which was deprecated in a particular version of FireFly and then convert it to the newest format. By progressively iterating through versions, a config file may be brought up to date with the latest expected format.
The secondary goal is for this script to be as easy to maintain as possible.
I've prototyped a partial solution in both Python and Go. Both have their advantages, so I'm looking for input on the final choice.In the end, the Python solution was not significantly simpler than the Go version, and would introduce a new language, packaging system, etc. I've decided to stick with Go.