Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions redisinsight/api/config/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export default {
},
encryption: {
keytar: process.env.RI_ENCRYPTION_KEYTAR ? process.env.RI_ENCRYPTION_KEYTAR === 'true' : true, // enabled by default
// !!! DO NOT CHANGE THIS VARIABLE FOR REDIS INSIGHT!!! MUST BE "redisinsight"!!! It's only for vscode extension
keytarService: process.env.RI_ENCRYPTION_KEYTAR_SERVICE || 'redisinsight',
encryptionIV: process.env.RI_ENCRYPTION_IV || Buffer.alloc(16, 0),
encryptionAlgorithm: process.env.RI_ENCRYPTION_ALGORYTHM || 'aes-256-cbc',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from 'src/modules/encryption/exceptions';
import config, { Config } from 'src/utils/config';

const SERVICE = 'redisinsight';
const ACCOUNT = 'app';
const SERVER_CONFIG = config.get('server') as Config['server'];
const ENCRYPTION_CONFIG = config.get('encryption') as Config['encryption'];
Expand Down Expand Up @@ -54,7 +53,7 @@ export class KeytarEncryptionStrategy implements IEncryptionStrategy {
*/
private async getPassword(): Promise<string | null> {
try {
return await this.keytar.getPassword(SERVICE, ACCOUNT);
return await this.keytar.getPassword(ENCRYPTION_CONFIG.keytarService, ACCOUNT);
} catch (error) {
this.logger.error('Unable to get password');
throw new KeytarUnavailableException();
Expand All @@ -68,7 +67,7 @@ export class KeytarEncryptionStrategy implements IEncryptionStrategy {
*/
private async setPassword(password: string): Promise<void> {
try {
await this.keytar.setPassword(SERVICE, ACCOUNT, password);
await this.keytar.setPassword(ENCRYPTION_CONFIG.keytarService, ACCOUNT, password);
} catch (error) {
this.logger.error('Unable to set password');
throw new KeytarUnavailableException();
Expand Down Expand Up @@ -109,7 +108,7 @@ export class KeytarEncryptionStrategy implements IEncryptionStrategy {
}

try {
await this.keytar.getPassword(SERVICE, ACCOUNT);
await this.keytar.getPassword(ENCRYPTION_CONFIG.keytarService, ACCOUNT);
return true;
} catch (e) {
return false;
Expand Down
Loading