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

Lookup config file paths and profile names from environment variables #334

Open
ThelloD opened this issue Mar 5, 2024 · 1 comment
Open
Assignees
Milestone

Comments

@ThelloD
Copy link

ThelloD commented Mar 5, 2024

Problem

I want to store my profiles at a different location than the default paths that resticprofile usually tries to resolve. Plus, I want to use resticprofile simply by running resticprofile.exe without having to specify the path to the config file every time via the -c, --config <path> command line flag.

Background

I tried to solve this by creating symlinks, however this does not always work since e.g. {{ .ConfigDir }} would then point to the symlink location instead of the actual location of the profile config file. Therefore, instructions such as includes: {{ .ConfigDir }}/../../defaults/presets.yaml won't work, because resticprofile would then look for the file e.g. at C:\Users\usr\AppData\Roaming\resticprofile/../../defaults/presets.yaml (=C:\Users\usr\AppData\defaults/presets.yaml), which of course does not exist, instead of e.g. D:\backups\profiles\win\mybackup\../../defaults/presets.yaml.

Of course this could be solved by using absolute paths in the config files, but I would like to have a library of generic and platform independent config files that don't need to be adapted on every system.

Solution

By looking up the config file paths from an environment variable such as $RESTICPROFILE_CONFIG, the user could specify the path to the profiles file without having to rely on resticprofile's path resolving logic and without specifying the path manually via the -c, --config command line switch.

Further, the same should also be possible to define a default profile name that is not called "default", e.g. $RESTICPROFILE_PROFILENAME. This would allow to specify a different default profile name than default when resticprofile is executed without the -n, --name command line flag.

@jkellerer jkellerer self-assigned this Mar 5, 2024
@jkellerer
Copy link
Collaborator

Agree, in fact all resticprofile cli args should have a dedicated env variable that defines their default when the arg is not set at command line.

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

3 participants