Skip to content

Conversation

@claudiodangelis
Copy link
Owner

@claudiodangelis claudiodangelis commented Oct 22, 2022

This PR adds viper configuration management.
Major changes:

  • configuration file will now use YAML rather than JSON
  • configuration parameters will be also read from the environment variable using the QRCP_ prefix

I'm still unsure whether or not we should add a function to automatically migrate the old JSON configuration file to YAML.

What is still missing:

  • README update
  • Proper testing of environment variables
  • Add migrate function to transparently migrate to the new YAML configuration file

@leestarb
Copy link

This is a good migration :). However I'd like to see backward compatibility with the JSON.

@claudiodangelis
Copy link
Owner Author

Hey @leestarb , thanks for checking in, there will be a function to automatically migrate to YAML at tool startup: https://github.com/claudiodangelis/qrcp/blob/0236150643d4a7358acd0f3ed1bda6853221d882/config/migrate.go

@leestarb
Copy link

Hey @leestarb , thanks for checking in, there will be a function to automatically migrate to YAML at tool startup: https://github.com/claudiodangelis/qrcp/blob/0236150643d4a7358acd0f3ed1bda6853221d882/config/migrate.go

No, no, no. Such function should change the config file ONLY if the user wants it. Otherwise this should convert it BUT not change the original file, like using converted one that was moved to the temp folder!

That is what I suggest :)

@claudiodangelis
Copy link
Owner Author

Hello @leestarb , I followed your advise and removed the automatic migration, thanks!

@claudiodangelis claudiodangelis merged commit 7499c16 into release-0-10-0 Apr 1, 2023
@claudiodangelis claudiodangelis deleted the 237-use-spf13viper-for-managing-the-configuration-file branch December 9, 2023 16:31
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.

4 participants