AuthMe / ConfigMe

A simple configuration management library for any Java project!
MIT License
37 stars 14 forks source link

Version-based migration service #344

Closed gamerover98 closed 1 year ago

gamerover98 commented 1 year ago

Description

Currently, ConfigMe lacks versioning capabilities, making it challenging to update configurations without issues and data loss.

Scenario Imagine that you are using ConfigMe to generate a YAML configuration file for an application. Currently, the library does not support version control for the generated configuration files. Here's what happens:

  1. Initial Configuration: You create the initial configuration file with all properties for the first version of the application. This is the configuration of the first version:

    potato:
    price: 10
    count: 100
    tomato:
    price: 5
    count: 150
  2. Software Update: The team releases a new version of the application with a lot of changes:

    shelf:
    - name: potato
    price: 10
    count: 100
    - name: tomato
    price: 5
    count: 150

As a result, the software update should have a way to convert from the first to the second configuration and so on. At the current ConfigMe release (1.3.1), the SettingsHolder will overwrite the old file with the new settings so, this may incur data loss and issues.


To address this problem, the proposed feature aims to introduce version control support in ConfigMe. By incorporating a "config-version" parameter to manage the version compatibility, ConfigMe can enable users to smoothly transition between different configuration versions while avoiding data loss and strange behavior. I guess that what we'd need is a class or override method that allows us to do the things said above.


Looking forward to your feedback and collaboration on this enhancement. Thank you 💯


Edit

Probably, I'm blind and I never seen the migration service. The only thing to do now adds specific functionalities to a custom implementation of the MigrationService interface by adding a version control system.

My idea is now to create a YAML file with a property called "config-version" or "version" and according to this value, the "VersionMigrationService" should be able to migrate all things.

ljacqu commented 1 year ago

Breaking changes