Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

minor: add a note to set environment variables

mngshm1166c6f723d5
diff --git a/cli/cmd/root.go b/cli/cmd/root.go
index e7f3378a44..782a89b8a8 100644
--- a/cli/cmd/root.go
+++ b/cli/cmd/root.go
@@ -20,7 +20,6 @@ var ctrl *pkg.ClICtrl
var rootCmd = &cobra.Command{
Use: "ente",
Short: "CLI tool for exporting your photos from ente.io",
- Long: `Start by creating a config file in your home directory:`,
// Uncomment the following line if your bare application
// has an action associated with it:
Run: func(cmd *cobra.Command, args []string) {
diff --git a/cli/main.go b/cli/main.go
index 79c8500dc3..8971443894 100644
--- a/cli/main.go
+++ b/cli/main.go
@@ -119,16 +119,25 @@ func initConfig(cliConfigDir string) {
// GetCLIConfigDir returns the path to the .ente-cli folder and creates it if it doesn't exist.
func GetCLIConfigDir() (string, error) {
var configDir = os.Getenv("ENTE_CLI_CONFIG_DIR")
- if configDir == "" {
- // for backward compatibility, check for ENTE_CLI_CONFIG_PATH
- configDir = os.Getenv("ENTE_CLI_CONFIG_PATH")
- }
+ // For backward compatibility
+ var oldConfigPath = os.Getenv("ENTE_CLI_CONFIG_PATH")
+
+ if configDir == "" {
+ // for backward compatibility, check for ENTE_CLI_CONFIG_PATH
+ configDir = os.Getenv("ENTE_CLI_CONFIG_PATH")
+ }
+
+ // Throw instructoin if none of the environment variables has been set.
+ if configDir == "" && oldConfigPath == "" {
+ fmt.Println(`Environment variable for the config dir is not set. Please setup
+the environment variable with export ENTE_CLI_CONFIG_DIR="/path/to/config"
+ `)
+ }
if configDir != "" {
// remove trailing slash (for all OS)
configDir = strings.TrimSuffix(configDir, string(filepath.Separator))
return configDir, nil
}
-
// Get the user's home directory
homeDir, err := os.UserHomeDir()
if err != nil {