diff --git a/packages/components/src/utils.ts b/packages/components/src/utils.ts index 239b13ca8..989368172 100644 --- a/packages/components/src/utils.ts +++ b/packages/components/src/utils.ts @@ -428,16 +428,7 @@ export const getEnvironmentVariable = (name: string): string | undefined => { * @returns {string} */ const getEncryptionKeyFilePath = (): string => { - const checkPaths = [ - path.join(__dirname, '..', '..', 'encryption.key'), - path.join(__dirname, '..', '..', 'server', 'encryption.key'), - path.join(__dirname, '..', '..', '..', 'encryption.key'), - path.join(__dirname, '..', '..', '..', 'server', 'encryption.key'), - path.join(__dirname, '..', '..', '..', '..', 'encryption.key'), - path.join(__dirname, '..', '..', '..', '..', 'server', 'encryption.key'), - path.join(__dirname, '..', '..', '..', '..', '..', 'encryption.key'), - path.join(__dirname, '..', '..', '..', '..', '..', 'server', 'encryption.key') - ] + const checkPaths = [path.join(getUserHome(), '.flowise', 'encryption.key')] for (const checkPath of checkPaths) { if (fs.existsSync(checkPath)) { return checkPath diff --git a/packages/server/src/utils/index.ts b/packages/server/src/utils/index.ts index eec813d4f..e0c917239 100644 --- a/packages/server/src/utils/index.ts +++ b/packages/server/src/utils/index.ts @@ -859,7 +859,7 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod export const getEncryptionKeyPath = (): string => { return process.env.SECRETKEY_PATH ? path.join(process.env.SECRETKEY_PATH, 'encryption.key') - : path.join(__dirname, '..', '..', 'encryption.key') + : path.join(getUserHome(), '.flowise', 'encryption.key') } /**