Skip to content

Commit e17f3e9

Browse files
Merge pull request #4117 from RedisInsight/be/feature/RI-6146_Turn_off_macos_encryption_dialog_for_VSCode
2 parents bedec89 + 68b52a3 commit e17f3e9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

redisinsight/api/config/default.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ export default {
8787
},
8888
encryption: {
8989
keytar: process.env.RI_ENCRYPTION_KEYTAR ? process.env.RI_ENCRYPTION_KEYTAR === 'true' : true, // enabled by default
90+
// !!! DO NOT CHANGE THIS VARIABLE FOR REDIS INSIGHT!!! MUST BE "redisinsight"!!! It's only for vscode extension
91+
keytarService: process.env.RI_ENCRYPTION_KEYTAR_SERVICE || 'redisinsight',
9092
encryptionIV: process.env.RI_ENCRYPTION_IV || Buffer.alloc(16, 0),
9193
encryptionAlgorithm: process.env.RI_ENCRYPTION_ALGORYTHM || 'aes-256-cbc',
9294
},

redisinsight/api/src/modules/encryption/strategies/keytar-encryption.strategy.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
} from 'src/modules/encryption/exceptions';
1212
import config, { Config } from 'src/utils/config';
1313

14-
const SERVICE = 'redisinsight';
1514
const ACCOUNT = 'app';
1615
const SERVER_CONFIG = config.get('server') as Config['server'];
1716
const ENCRYPTION_CONFIG = config.get('encryption') as Config['encryption'];
@@ -54,7 +53,7 @@ export class KeytarEncryptionStrategy implements IEncryptionStrategy {
5453
*/
5554
private async getPassword(): Promise<string | null> {
5655
try {
57-
return await this.keytar.getPassword(SERVICE, ACCOUNT);
56+
return await this.keytar.getPassword(ENCRYPTION_CONFIG.keytarService, ACCOUNT);
5857
} catch (error) {
5958
this.logger.error('Unable to get password');
6059
throw new KeytarUnavailableException();
@@ -68,7 +67,7 @@ export class KeytarEncryptionStrategy implements IEncryptionStrategy {
6867
*/
6968
private async setPassword(password: string): Promise<void> {
7069
try {
71-
await this.keytar.setPassword(SERVICE, ACCOUNT, password);
70+
await this.keytar.setPassword(ENCRYPTION_CONFIG.keytarService, ACCOUNT, password);
7271
} catch (error) {
7372
this.logger.error('Unable to set password');
7473
throw new KeytarUnavailableException();
@@ -109,7 +108,7 @@ export class KeytarEncryptionStrategy implements IEncryptionStrategy {
109108
}
110109

111110
try {
112-
await this.keytar.getPassword(SERVICE, ACCOUNT);
111+
await this.keytar.getPassword(ENCRYPTION_CONFIG.keytarService, ACCOUNT);
113112
return true;
114113
} catch (e) {
115114
return false;

0 commit comments

Comments
 (0)