dropbox / dbxcli

A command line client for Dropbox built using the Go SDK
Other
1.04k stars 102 forks source link

feat: improve environment support #206

Open stevenh opened 8 months ago

stevenh commented 8 months ago

Improve support for configuring the tool from the environment as is commonly used for CI use cases.

This adds the ability to read auth tokens from the DROPBOX_TOKENS environment variable instead of from the configuration file.

Also add the ability to configured the personal app key which wasn't named and now configurable using DROPBOX_PERSONAL_APP_KEY environment variable to match the other options.

Constants for config location and environment variable names are now stored in consts.go to make them more visible.

Some additional improvement in error checking and extracting the common configFile helper, including using stdlib os.UserHomeDir instead of the custom library version.

Switch from deprecated ioutil.ReadFile to supported os.ReadFile.