Skip to content
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

Add a config file #163

Open
14sxlin opened this issue Sep 4, 2021 · 3 comments
Open

Add a config file #163

14sxlin opened this issue Sep 4, 2021 · 3 comments

Comments

@14sxlin
Copy link

14sxlin commented Sep 4, 2021

maybe it can use a system env variable to assign a default repository allowing omitting arguement.
e.g: CONSERVE_DEFAULT_REPOSITORY

@sourcefrog
Copy link
Owner

Perhaps it's easy enough to apply the variable in a shell script or shell command line that calls conserve? Or, can you tell me more about the use case for this?

@14sxlin
Copy link
Author

14sxlin commented Sep 7, 2021

TLNR: just for omitting an argument

It's inspired by another backup file tool: "https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html".
It uses "RESTIC_REPOSITORY" env as the default backup repository which allows us to omit the repo parameter.
For example , in command "conserve backup /backup/home.cons", we need to assign argument "/backup/home.cons".
I think it's more convenient if we use "conserve backup" , then the program first checks whether CONSERVE_DEFAULT_REPOSITORY env exists. If CONSERVE_DEFAULT_REPOSITORY has some path then use it as repo, otherwise report an error.

@sourcefrog
Copy link
Owner

I see. I can see the attraction of just running one command to make a backup: at the moment I have a shell script that I run, but perhaps it'd be a better UX to not need that and have Conserve remember what to do.

Because the repository argument comes first and is an argument rather than a named option, this seems to need some thought about how to change the command-line interface. It might be OK to make the first option optional, but that does get a bit weird, and from memory some commands have more than two arguments, which makes it very ambiguous.

Couple other thoughts:

Maybe environment variables aren't the best way to set a default? They have a somewhat poor UX to set, especially on Windows. Maybe a config file would be better.

Having a single default repository makes more sense if that repo can store multiple independent sources, which is #101.

As well as remembering the repo, maybe Conserve should get the source and exclusions from a configuration file. Then the default invocation could take no arguments, which might be nice. And this would move away from the pattern I have now of effectively configuring it through a wrapper script. Probably the first step on this is to sketch the instructions for using such a system.

@sourcefrog sourcefrog changed the title use system env variblae to assign default repository automatically find the repository Mar 20, 2022
@sourcefrog sourcefrog changed the title automatically find the repository Add a config file Aug 14, 2022
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

No branches or pull requests

2 participants