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
Storing defaults for global flags in the config file (profiles) #2697
Comments
I would also love to see this. But judging by the milestone shifting I'm guessing it's hard to implement? |
So much to do, so little time :-) It isn't particularly tricky - fancy helping out? |
I'm looking to configure rclone to enable things like |
@kevin-hanselman |
Yes this is the issue. However as @ivandeex points out you could set an env var |
We already have following config sources (ordered from low to high priority): This can be implemented as a new config source Inheritance of profile section
@albertony @ncw thoughts? |
Is this feature implemented yet? I want to add flags to all rclone commands by default without the shell. |
Using alias for now. alias rclone='rclone --progress --bwlimit 4.2M --transfers=1' |
An added benefit of supporting those flags in the config file, would be for situations where rclone is used via the API and not run through the CLI. |
@dalbani wrote:
I guess you mean the internal Go API here? Would you like to work on this PR?
That is a very nice bit of work! I'll just note that we don't particularly guarantee stability of the internal rclone interfaces. I try not to break them though :-) |
@ncw I took a stab at implementing this. It's still a WIP but if you have a moment, it would be very helpful if you could take a peek and let me know if I'm on the right track: nielash@60b9568 Features:
There are a number of (passing!) tests here that show the intended use: |
Very nice list of features :-) You've done a very thorough job. This is going to need lots of docs! I did also have the idea that we could introduce global flags to set when using a backend. So when you do
This would set the So if we could arrange for the profile settings and the flag settings not to clash then we can enable this if we want. Looking at the code you are using
Very nice feature!
This should probably just be
This should probably default to true - if you put args in the profile then you'd expect to use them.
How do you do that - I missed that in the code. This could potentially be the mechanism for including a profile in a backend definition rather than including the flags directly.
All good!
Nice! I think what this needs next is
Very nice work :-) |
Very helpful feedback -- thank you!
In the config they are saved as a comma-separated list under the The priority of conflicting settings is resolved in an order of lowest to highest, with parents all lower than child. (In other words, think of parents as a set of defaults that are inherited but can be overridden at will.) This test shows it in action.
I like this idea a lot. It is sort of already possible with the
then But this does have some drawbacks -- you'd need to know in advance which arg number it would be, and it is also not very flexible if you want to use some other path at that remote. Tying global flags to remotes is a really interesting idea and I agree it would be useful. One question I have though is how conflicting flags would be handled in commands that use more than one remote. For example, suppose I sync two remotes, one of which has Another possible implementation to consider: what if an Fs remote could take an optional I'll give this more thought, as I agree it would be quite handy! (A use that comes up for me a lot is wanting to use
Absolutely! That's a given.
I agree. I'll change it in the next draft.
My slight hesitation about this is that I'm not sure if that assumption also holds true when saving a profile. For example, if I do:
would you expect that to save the paths too? Or just |
@nielash Does it support stringArray in your implements? Some config flags can be passed multiple, eg |
Very good point! Yes, it should be supported, however it would be merged into one key in the config. For example:
would become:
The reason is because if you did this:
it would be invalid INI (can't have duplicate keys in the same section) |
Make a global config setting for rclone
In the rclone config file have configuration for "profiles". These are default settings for all the rclone flags.
So the flag "--delete-during" would be stored like this in the config in the default profile.
Rclone would provide the
--profile
flag to use a different profile and providerclone config profile
to edit the profile with a config profile editor wizard.Backend flags should be settable in the profile also - basically any flag that rclone has should be settable in the profile (just like it is settable in the environment already).
Extension idea: could inherit from other profiles.
The text was updated successfully, but these errors were encountered: