Skip to content

Commit 9031057

Browse files
committed
add FLOWISE_SECRETKEY_OVERWRITE
1 parent c917e2f commit 9031057

File tree

9 files changed

+54
-77
lines changed

9 files changed

+54
-77
lines changed

CONTRIBUTING-ZH.md

+20-19
Original file line numberDiff line numberDiff line change
@@ -118,25 +118,26 @@ Flowise 在一个单一的单体存储库中有 3 个不同的模块。
118118

119119
Flowise 支持不同的环境变量来配置您的实例。您可以在 `packages/server` 文件夹中的 `.env` 文件中指定以下变量。阅读[更多信息](https://docs.flowiseai.com/environment-variables)
120120

121-
| 变量名 | 描述 | 类型 | 默认值 |
122-
| -------------------------- | ------------------------------------------------------ | ----------------------------------------------- | ----------------------------------- |
123-
| PORT | Flowise 运行的 HTTP 端口 | 数字 | 3000 |
124-
| FLOWISE_USERNAME | 登录用户名 | 字符串 | |
125-
| FLOWISE_PASSWORD | 登录密码 | 字符串 | |
126-
| DEBUG | 打印组件的日志 | 布尔值 | |
127-
| LOG_PATH | 存储日志文件的位置 | 字符串 | `your-path/Flowise/logs` |
128-
| LOG_LEVEL | 日志的不同级别 | 枚举字符串: `error`, `info`, `verbose`, `debug` | `info` |
129-
| APIKEY_PATH | 存储 API 密钥的位置 | 字符串 | `your-path/Flowise/packages/server` |
130-
| TOOL_FUNCTION_BUILTIN_DEP | 用于工具函数的 NodeJS 内置模块 | 字符串 | |
131-
| TOOL_FUNCTION_EXTERNAL_DEP | 用于工具函数的外部模块 | 字符串 | |
132-
| OVERRIDE_DATABASE | 是否使用默认值覆盖当前数据库 | 枚举字符串: `true`, `false` | `true` |
133-
| DATABASE_TYPE | 存储 flowise 数据的数据库类型 | 枚举字符串: `sqlite`, `mysql`, `postgres` | `sqlite` |
134-
| DATABASE_PATH | 数据库保存的位置(当 DATABASE_TYPE 是 sqlite 时) | 字符串 | `your-home-dir/.flowise` |
135-
| DATABASE_HOST | 主机 URL 或 IP 地址(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
136-
| DATABASE_PORT | 数据库端口(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
137-
| DATABASE_USERNAME | 数据库用户名(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
138-
| DATABASE_PASSWORD | 数据库密码(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
139-
| DATABASE_NAME | 数据库名称(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
121+
| 变量名 | 描述 | 类型 | 默认值 |
122+
| --------------------------- | ------------------------------------------------------ | ----------------------------------------------- | ----------------------------------- |
123+
| PORT | Flowise 运行的 HTTP 端口 | 数字 | 3000 |
124+
| FLOWISE_USERNAME | 登录用户名 | 字符串 | |
125+
| FLOWISE_PASSWORD | 登录密码 | 字符串 | |
126+
| DEBUG | 打印组件的日志 | 布尔值 | |
127+
| LOG_PATH | 存储日志文件的位置 | 字符串 | `your-path/Flowise/logs` |
128+
| LOG_LEVEL | 日志的不同级别 | 枚举字符串: `error`, `info`, `verbose`, `debug` | `info` |
129+
| APIKEY_PATH | 存储 API 密钥的位置 | 字符串 | `your-path/Flowise/packages/server` |
130+
| TOOL_FUNCTION_BUILTIN_DEP | 用于工具函数的 NodeJS 内置模块 | 字符串 | |
131+
| TOOL_FUNCTION_EXTERNAL_DEP | 用于工具函数的外部模块 | 字符串 | |
132+
| DATABASE_TYPE | 存储 flowise 数据的数据库类型 | 枚举字符串: `sqlite`, `mysql`, `postgres` | `sqlite` |
133+
| DATABASE_PATH | 数据库保存的位置(当 DATABASE_TYPE 是 sqlite 时) | 字符串 | `your-home-dir/.flowise` |
134+
| DATABASE_HOST | 主机 URL 或 IP 地址(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
135+
| DATABASE_PORT | 数据库端口(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
136+
| DATABASE_USERNAME | 数据库用户名(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
137+
| DATABASE_PASSWORD | 数据库密码(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
138+
| DATABASE_NAME | 数据库名称(当 DATABASE_TYPE 不是 sqlite 时) | 字符串 | |
139+
| SECRETKEY_PATH | 保存加密密钥(用于加密/解密凭据)的位置 | 字符串 | `your-path/Flowise/packages/server` |
140+
| FLOWISE_SECRETKEY_OVERWRITE | 加密密钥用于替代存储在 SECRETKEY_PATH 中的密钥 | 字符串 |
140141

141142
您也可以在使用 `npx` 时指定环境变量。例如:
142143

CONTRIBUTING.md

+20-21
Original file line numberDiff line numberDiff line change
@@ -120,27 +120,26 @@ Flowise has 3 different modules in a single mono repository.
120120

121121
Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder. Read [more](https://docs.flowiseai.com/environment-variables)
122122

123-
| Variable | Description | Type | Default |
124-
| -------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
125-
| PORT | The HTTP port Flowise runs on | Number | 3000 |
126-
| FLOWISE_USERNAME | Username to login | String | |
127-
| FLOWISE_PASSWORD | Password to login | String | |
128-
| DEBUG | Print logs from components | Boolean | |
129-
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` |
130-
| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
131-
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
132-
| TOOL_FUNCTION_BUILTIN_DEP | NodeJS built-in modules to be used for Tool Function | String | |
133-
| TOOL_FUNCTION_EXTERNAL_DEP | External modules to be used for Tool Function | String | |
134-
| OVERRIDE_DATABASE | Override current database with default | Enum String: `true`, `false` | `true` |
135-
| DATABASE_TYPE | Type of database to store the flowise data | Enum String: `sqlite`, `mysql`, `postgres` | `sqlite` |
136-
| DATABASE_PATH | Location where database is saved (When DATABASE_TYPE is sqlite) | String | `your-home-dir/.flowise` |
137-
| DATABASE_HOST | Host URL or IP address (When DATABASE_TYPE is not sqlite) | String | |
138-
| DATABASE_PORT | Database port (When DATABASE_TYPE is not sqlite) | String | |
139-
| DATABASE_USER | Database username (When DATABASE_TYPE is not sqlite) | String | |
140-
| DATABASE_PASSWORD | Database password (When DATABASE_TYPE is not sqlite) | String | |
141-
| DATABASE_NAME | Database name (When DATABASE_TYPE is not sqlite) | String | |
142-
| PASSPHRASE | Passphrase used to create encryption key | String | `MYPASSPHRASE` |
143-
| SECRETKEY_PATH | Location where encryption key (used to encrypt/decrypt credentials) is saved | String | `your-path/Flowise/packages/server` |
123+
| Variable | Description | Type | Default |
124+
| --------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- | --- |
125+
| PORT | The HTTP port Flowise runs on | Number | 3000 |
126+
| FLOWISE_USERNAME | Username to login | String | |
127+
| FLOWISE_PASSWORD | Password to login | String | |
128+
| DEBUG | Print logs from components | Boolean | |
129+
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` |
130+
| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
131+
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
132+
| TOOL_FUNCTION_BUILTIN_DEP | NodeJS built-in modules to be used for Tool Function | String | |
133+
| TOOL_FUNCTION_EXTERNAL_DEP | External modules to be used for Tool Function | String | | |
134+
| DATABASE_TYPE | Type of database to store the flowise data | Enum String: `sqlite`, `mysql`, `postgres` | `sqlite` |
135+
| DATABASE_PATH | Location where database is saved (When DATABASE_TYPE is sqlite) | String | `your-home-dir/.flowise` |
136+
| DATABASE_HOST | Host URL or IP address (When DATABASE_TYPE is not sqlite) | String | |
137+
| DATABASE_PORT | Database port (When DATABASE_TYPE is not sqlite) | String | |
138+
| DATABASE_USER | Database username (When DATABASE_TYPE is not sqlite) | String | |
139+
| DATABASE_PASSWORD | Database password (When DATABASE_TYPE is not sqlite) | String | |
140+
| DATABASE_NAME | Database name (When DATABASE_TYPE is not sqlite) | String | |
141+
| SECRETKEY_PATH | Location where encryption key (used to encrypt/decrypt credentials) is saved | String | `your-path/Flowise/packages/server` |
142+
| FLOWISE_SECRETKEY_OVERWRITE | Encryption key to be used instead of the key stored in SECRETKEY_PATH | String |
144143

145144
You can also specify the env variables when using `npx`. For example:
146145

docker/.env.example

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
PORT=3000
2-
PASSPHRASE=MYPASSPHRASE # Passphrase used to create encryption key
32
DATABASE_PATH=/root/.flowise
43
APIKEY_PATH=/root/.flowise
54
SECRETKEY_PATH=/root/.flowise
@@ -13,10 +12,10 @@ LOG_PATH=/root/.flowise/logs
1312
# DATABASE_NAME="flowise"
1413
# DATABASE_USER=""
1514
# DATABASE_PASSWORD=""
16-
# OVERRIDE_DATABASE=true
1715

1816
# FLOWISE_USERNAME=user
1917
# FLOWISE_PASSWORD=1234
18+
# FLOWISE_SECRETKEY_OVERWRITE=myencryptionkey
2019
# DEBUG=true
2120
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
2221
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs

docker/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ services:
66
restart: always
77
environment:
88
- PORT=${PORT}
9-
- PASSPHRASE=${PASSPHRASE}
109
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
1110
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
1211
- DEBUG=${DEBUG}
1312
- DATABASE_PATH=${DATABASE_PATH}
1413
- APIKEY_PATH=${APIKEY_PATH}
1514
- SECRETKEY_PATH=${SECRETKEY_PATH}
15+
- FLOWISE_SECRETKEY_OVERWRITE=${FLOWISE_SECRETKEY_OVERWRITE}
1616
- LOG_LEVEL=${LOG_LEVEL}
1717
- LOG_PATH=${LOG_PATH}
1818
ports:

packages/components/src/utils.ts

+3
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ const getEncryptionKeyPath = (): string => {
396396
* @returns {Promise<string>}
397397
*/
398398
const getEncryptionKey = async (): Promise<string> => {
399+
if (process.env.FLOWISE_SECRETKEY_OVERWRITE !== undefined && process.env.FLOWISE_SECRETKEY_OVERWRITE !== '') {
400+
return process.env.FLOWISE_SECRETKEY_OVERWRITE
401+
}
399402
try {
400403
return await fs.promises.readFile(getEncryptionKeyPath(), 'utf8')
401404
} catch (error) {

packages/server/.env.example

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
PORT=3000
2-
PASSPHRASE=MYPASSPHRASE # Passphrase used to create encryption key
32
# DATABASE_PATH=/your_database_path/.flowise
43
# APIKEY_PATH=/your_api_key_path/.flowise
54
# SECRETKEY_PATH=/your_api_key_path/.flowise
@@ -13,10 +12,10 @@ PASSPHRASE=MYPASSPHRASE # Passphrase used to create encryption key
1312
# DATABASE_NAME="flowise"
1413
# DATABASE_USER=""
1514
# DATABASE_PASSWORD=""
16-
# OVERRIDE_DATABASE=true
1715

1816
# FLOWISE_USERNAME=user
1917
# FLOWISE_PASSWORD=1234
18+
# FLOWISE_SECRETKEY_OVERWRITE=myencryptionkey
2019
# DEBUG=true
2120
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
2221
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs

0 commit comments

Comments
 (0)