-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Describe the feature:
Improve the backup schedule configuration by using a configuration file (.config.toml) for the user, instead of hard-coding the interval values directly in the code. The idea is to allow the user to define the backup frequency in a more flexible way, by editing the configuration, and then the program can read this configuration to determine the time interval.
Tasks:
- Create a configuration file
~/.purrgres/.config.tomlthat contains the time settings.
- Example structure:
[general]
backup_interval = "1day" # Can be "1day", "1month", "7days", etc.- In the source code, modify the way to define the backup interval:
- Currently, we have:
let schedule = utils::schedule::Schedule::OneDay; let mut interval = time::interval(schedule.to_duration());- Override this so that
backup_intervalis read from the TOML configuration and turned into the appropriate enum.
- Modify the code so that when the backup process starts, the program reads the configuration file and sets the backup interval based on the stored value.
- Example of how this might be read:
let config_path = utils::path::get_config_path();
let config = toml::de::from_str(&fs::read_to_string(config_path).expect("Failed to read config file"))
.expect("Failed to parse TOML file");
let schedule = match config.intervalo_de_backup.as_str() {
"1day" => utils::schedule::Schedule::OneDay,
"7days" => utils::schedule::Schedule::SevenDays,
"1month" => utils::schedule::Schedule::OneMonth,
_ => utils::schedule::Schedule::OneDay, // Default value
};- Create a new command in the CLI to allow the user to set the backup frequency directly, for example:
- Command to set the backup interval:
purrgres --set-interval "7days"- This command should update the
.config.tomlfile with the new interval value.
- Test the correct reading and setting of the values and ensure that the change in the configuration file is reflected in the program's behavior.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed