π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
CLI: Allow setting secrets path via env var
Pablo Ovelleiro Corral97b5577d68f9
diff --git a/cli/pkg/secrets/secret.go b/cli/pkg/secrets/secret.goindex 1ebd13a1d6..82df5c7ea1 100644--- a/cli/pkg/secrets/secret.go+++ b/cli/pkg/secrets/secret.go@@ -26,10 +26,15 @@ const (func GetOrCreateClISecret() []byte {// get passwordsecret, err := keyring.Get(secretService, secretUser)+if err != nil {if !errors.Is(err, keyring.ErrNotFound) {++ if secretsFile := os.Getenv("ENTE_CLI_SECRETS_PATH"); secretsFile != "" {+ return GetSecretFromSecretText(secretsFile)+ }if IsRunningInContainer() {- return GetSecretFromSecretText()+ return GetSecretFromSecretText(fmt.Sprintf("%s.secret.txt", constants.CliDataPath))} else {log.Fatal(fmt.Errorf("error getting password from keyring: %w", err))}@@ -51,9 +56,7 @@ func GetOrCreateClISecret() []byte {// GetSecretFromSecretText reads the scecret from the secret text file.// If the file does not exist, it will be created and write random 32 byte secret to it.-func GetSecretFromSecretText() []byte {- // Define the path to the secret text file- secretFilePath := fmt.Sprintf("%s.secret.txt", constants.CliDataPath)+func GetSecretFromSecretText(secretFilePath string) []byte {// Check if file exists_, err := os.Stat(secretFilePath)