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 where "must have" files are more flexible #45
Comments
I think the flexibility suggested is good and I suggest we think about the approach that is most OS-agnostic. I'm not sure about how we would handle environment vars in Windows. Alternatively, and I'm not necessarily saying it would be a better approach, we could have a If we find out we could support os.getenv() seamlessly on Windows/MacOS/*nix, that's a good approach. |
Flexibility is a good option. I like both ideas mentioned. One thing to take note regarding the default values. I think we could have them stored in a folder inside the project itself. This way we could access them using a relative paths and not necessarily have to worry about differences between os.getenv() from all operating systems to figure out where the files are stored. Also, if we ever intend to package the application and distribute it as an app the user could input the credentials.json to the app. |
@CarlosRodrigo, having the configs in the user home allows for 1 binary -> N users, which would possibly be a common use case if the user installs the script in a system-wide location to be shared across multiple users. That would break if we chose to put the configs in the project root. |
@psteiger Hm.. good point. If we were to choose the project root solution, we would have to have a folder for each user that wants the app configured then.. But I think we can find a way to have multiple configurations and I think they should be in the project root. I say that because for example: if I have more than one Google account where I use the drive for each account, what we have to do now is to have two It would be like a 1 binary -> N configurations not even taking into considerations the amount of users. That means that an user could have multiple configurations. Maybe we could have something like: gdrive/accounts/1/token.pickle And have a config.json file where we define the default account {
"default-account": 1
} And we could add some new commands and parameters to gdrive itself:
We could set aliases to make it easier to identify which account is which. |
Ok. I like the idea of 1 project root binary and each user having his {
"email@gmail.com": {
"a": 5,
"c": 6
},
"email2@gmail.com": {
"a": 4,
"c": 1
}
} Windows handles this in a similar fashion, e.g. Steam and AppData. That also makes it automatic to delete user config if user is deleted from the system. If a user is deleted from a system, his Your suggestion says that we should put |
Great point again! I agree with you and I now think we should have a {
"download-chunksize": "X",
"upload-chunksize": "Y",
"configured-accounts": {
"email@gmail.com": {
"id": "1",
"alias": "maybe?"
}
},
"default-account": 1
} |
Completely agree with the discussion so far in regards to configuration. Perhaps we could experiment with creating this .json on the first run of the app with the default values, adding it to .gitignore. |
@jrcamelo , user config files should not be put on version control, indeed. If any, just a default json file on project root that would serve as basis for user config files generation, but maybe not even that: we could generate the json on runtime through code. |
What about we give the user the choice to where the credentials.json and the token.pickle should be.
Instead of just making users have a
.gdrive
in their home directory, we could have something that allowed users to change that more easily than going into the code.Maybe read from an environment variable and if it doesn't exist, we default it to what we have today.
This line here:
GDRIVE_PATH = join(HOME, '.gdrive')
We could have something like:
GDRIVE_PATH = os.getenv('GDRIVE_PATH') if os.getenv('GDRIVE_PATH') != null else join(HOME, '.gdrive')
ps: I have no idea if this code above works, it's just an example.
What do you think?
The text was updated successfully, but these errors were encountered: