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

Make sync mode(default, download-only , upload-only, local-first, no-remote-delete) an option in config #356

Closed
CaulyKan opened this issue Jan 22, 2019 · 17 comments

Comments

@CaulyKan
Copy link

CaulyKan commented Jan 22, 2019

When using docker with onedrive, it's quite a difficult work to modify entrypoint.sh and change arguments of onedrive command. So it would be better to make use of config file to take full control of onedrive behavior, especially the sync mode.

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Add a sync_mode option to config file, available values:

  • default
  • upload-only
  • download-only
  • local-first
  • no-remote-delete
    and use them the same way they work in arguments.
@CaulyKan CaulyKan changed the title Make sync mode(default, upload-only, local-first, no-remote-delete) an option in config Make sync mode(default, download-only , upload-only, local-first, no-remote-delete) an option in config Jan 22, 2019
@norbusan
Copy link
Collaborator

Hi

I think in principle it is a good idea what you propose, only that the format is not optimal. How would you specify an upload-only with no-remote-delete?

So if we go in this direction, I suggest that every command line option can have a respective setting in the config file, and the command line takes priority over the config file (as usual).

@abraunegg WDYT? Should I look into this?

@abraunegg
Copy link
Owner

@CaulyKan
It is certainly an interesting use case, however I need to understand further how any why 'modify entrypoint.sh and change arguments' is so difficult in a docker environment.

@norbusan
Agree - the proposed method is sub-optimal.

Potentially what would be better is:

cli_options = "<your desired options> eg: --single-directory 'blah' --upload-only"

This then could accept any number of valid parameters, with then any actual CLI entries taking further priority.

So if we go in this direction, I suggest that every command line option can have a respective setting in the config file, and the command line takes priority over the config file (as usual).

We could also go in this direction where the command line option makes sense for a 'config' file option. Switches like --source-directory & --destination-directory for moving folders on OneDrive would not make much sense to have a 'config' file option.

@norbusan
Copy link
Collaborator

norbusan commented Jan 22, 2019

@abraunegg agreed that some switches don't make sense, indeed.

Concerning the cli_options versus single options, I am undecided. Parsing the cli_options with spaces, embedded " etc might be a bit a pain. Also I think that having single options is a bit clearer.

So I would tend to have single options instead of one cli_options, but it is really a matter of taste and I don't have strong feelings about it.

If we agree on one method, I can look at the implemetation

@CaulyKan
Copy link
Author

As far as I can tell, there are several ways to modify entrypoint.sh:

  1. clone the repo and edit entrypoint.sh, then docker build.
  2. make a new dockerfile like 'FROM origin CP new_entrypoint.sh ENTRYPOINT new_entrypoint.sh' and build it.
  3. run the image and then exec -it bash into it and vi entrypoint.sh. However I'm not sure why this method can't be used becaused every time I try to do this with onedrive container I got an EOF only.

The third way have other problem: when the container starts the sync starts immediately. If I want to change to upload-only I have to disable the config to make the sync fail.

@norbusan
Copy link
Collaborator

I agree with @CaulyKan that adjustment of the docker entry points is not what we want to be necessary. In an ideal world it should be as described in the docker/README.md and configuration option can simply be set in via -v onedrive_conf:/onedrive/conf which makes maintenance much easier.

@CaulyKan
Copy link
Author

I've submitted a pr on docker/README.md #358

@CaulyKan
Copy link
Author

By the way, is there any one working on gui? I think a self-contained web ui should work best with docker. If nobody is working on it, maybe I can give a try.

@norbusan
Copy link
Collaborator

@CaulyKan gui discussion is not really related here, but no, nobody works on it AFAIS. I have looked into writing a applet in D, but GUI toolkits for D are rare and a bit a pain. Furthermore, the current onedrive client is not set up in a way that it could communicate with a frontend (no multi-threading, information handling ...).

So writing a GUI - even a self-contained web ui which needs support from the backend - is future work which we haven't initiated by now.

@abraunegg
Copy link
Owner

@abraunegg agreed that some switches don't make sense, indeed.

Concerning the cli_options versus single options, I am undecided. Parsing the cli_options with spaces, embedded " etc might be a bit a pain. Also I think that having single options is a bit clearer.

So I would tend to have single options instead of one cli_options, but it is really a matter of taste and I don't have strong feelings about it.

If we agree on one method, I can look at the implemetation

If it is simpler & easier for each option to have it's own 'config' option, then no issue there.

@abraunegg

This comment has been minimized.

@norbusan
Copy link
Collaborator

norbusan commented Apr 1, 2019

Merge into master, I think this can be closed.

@abraunegg
Copy link
Owner

PR #389 merged

@abraunegg
Copy link
Owner

Re-opening issue as PR #389 broke client configuration option parsing

@abraunegg abraunegg reopened this Apr 1, 2019
@abraunegg abraunegg added In Progress Currently being worked on and removed Fixed labels Apr 1, 2019
@abraunegg abraunegg modified the milestones: 2.3.2, v2.3.3 Apr 1, 2019
@CaulyKan
Copy link
Author

CaulyKan commented Apr 3, 2019

eh...document not updated? not sure how to start with the new version, where shall I put sync mode in config?

@abraunegg
Copy link
Owner

@CaulyKan
Can you please help test and evaluate PR #449 against this feature request to have all CLI options as a config file option?

git clone https://github.com/abraunegg/onedrive.git
cd onedrive
git fetch origin pull/449/head:pr449
git checkout pr449
make
make install

Any feedback you have is greatly appreciated

@abraunegg
Copy link
Owner

Closing as PR #449 merged

@lock
Copy link

lock bot commented May 11, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators May 11, 2019
@abraunegg abraunegg added Implemented and removed In Progress Currently being worked on labels Jun 7, 2019
darrenedale pushed a commit to darrenedale/onedrive that referenced this issue Aug 4, 2022
* Add an additional check for 409 (Conflict) being returned when creating directories even when the directory is only attempted to be created when it cannot be found.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants