Merge pull request #641 from FlowiseAI/bugfix/Default-EncryptionKey-FilePath

Bugfix/default encryption key file path
This commit is contained in:
Henry Heng
2023-07-29 02:12:52 +01:00
committed by GitHub
2 changed files with 9 additions and 1 deletions
+4
View File
@@ -355,9 +355,13 @@ export const getEnvironmentVariable = (name: string): string | undefined => {
*/ */
const getEncryptionKeyFilePath = (): string => { const getEncryptionKeyFilePath = (): string => {
const checkPaths = [ const checkPaths = [
path.join(__dirname, '..', '..', 'encryption.key'),
path.join(__dirname, '..', '..', 'server', 'encryption.key'), path.join(__dirname, '..', '..', 'server', 'encryption.key'),
path.join(__dirname, '..', '..', '..', 'encryption.key'),
path.join(__dirname, '..', '..', '..', 'server', 'encryption.key'), path.join(__dirname, '..', '..', '..', 'server', 'encryption.key'),
path.join(__dirname, '..', '..', '..', '..', 'encryption.key'),
path.join(__dirname, '..', '..', '..', '..', 'server', 'encryption.key'), path.join(__dirname, '..', '..', '..', '..', 'server', 'encryption.key'),
path.join(__dirname, '..', '..', '..', '..', '..', 'encryption.key'),
path.join(__dirname, '..', '..', '..', '..', '..', 'server', 'encryption.key') path.join(__dirname, '..', '..', '..', '..', '..', 'server', 'encryption.key')
] ]
for (const checkPath of checkPaths) { for (const checkPath of checkPaths) {
+5 -1
View File
@@ -44,7 +44,8 @@ import {
transformToCredentialEntity, transformToCredentialEntity,
decryptCredentialData, decryptCredentialData,
clearSessionMemory, clearSessionMemory,
replaceInputsWithConfig replaceInputsWithConfig,
getEncryptionKey
} from './utils' } from './utils'
import { cloneDeep, omit } from 'lodash' import { cloneDeep, omit } from 'lodash'
import { getDataSource } from './DataSource' import { getDataSource } from './DataSource'
@@ -82,6 +83,9 @@ export class App {
// Initialize API keys // Initialize API keys
await getAPIKeys() await getAPIKeys()
// Initialize encryption key
await getEncryptionKey()
}) })
.catch((err) => { .catch((err) => {
logger.error('❌ [server]: Error during Data Source initialization:', err) logger.error('❌ [server]: Error during Data Source initialization:', err)