mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
update default location for encryption key
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
convertChatHistoryToText,
|
||||
getInputVariables,
|
||||
handleEscapeCharacters,
|
||||
getEncryptionKeyPath,
|
||||
ICommonObject,
|
||||
IDatabaseEntity,
|
||||
IMessage
|
||||
@@ -852,16 +853,6 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
|
||||
return isChatOrLLMsExist && isValidChainOrAgent && !isOutputParserExist
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path of encryption key
|
||||
* @returns {string}
|
||||
*/
|
||||
export const getEncryptionKeyPath = (): string => {
|
||||
return process.env.SECRETKEY_PATH
|
||||
? path.join(process.env.SECRETKEY_PATH, 'encryption.key')
|
||||
: path.join(getUserHome(), '.flowise', 'encryption.key')
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an encryption key
|
||||
* @returns {string}
|
||||
@@ -882,7 +873,8 @@ export const getEncryptionKey = async (): Promise<string> => {
|
||||
return await fs.promises.readFile(getEncryptionKeyPath(), 'utf8')
|
||||
} catch (error) {
|
||||
const encryptKey = generateEncryptKey()
|
||||
await fs.promises.writeFile(getEncryptionKeyPath(), encryptKey)
|
||||
const defaultLocation = path.join(getUserHome(), '.flowise', 'encryption.key')
|
||||
await fs.promises.writeFile(defaultLocation, encryptKey)
|
||||
return encryptKey
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user