add env path for settings json

This commit is contained in:
Henry
2024-01-21 18:24:54 +00:00
parent 6e4b2b0946
commit 5d25c35a1a
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -1099,6 +1099,7 @@ export const getTelemetryFlowObj = (nodes: IReactFlowNode[], edges: IReactFlowEd
* TODO: move env variables to settings json file, easier configuration * TODO: move env variables to settings json file, easier configuration
*/ */
export const getUserSettingsFilePath = () => { export const getUserSettingsFilePath = () => {
if (process.env.SECRETKEY_PATH) return path.join(process.env.SECRETKEY_PATH, 'settings.json')
const checkPaths = [path.join(getUserHome(), '.flowise', 'settings.json')] const checkPaths = [path.join(getUserHome(), '.flowise', 'settings.json')]
for (const checkPath of checkPaths) { for (const checkPath of checkPaths) {
if (fs.existsSync(checkPath)) { if (fs.existsSync(checkPath)) {
+3 -1
View File
@@ -25,7 +25,9 @@ export class Telemetry {
const settings = { const settings = {
instanceId instanceId
} }
const defaultLocation = path.join(getUserHome(), '.flowise', 'settings.json') const defaultLocation = process.env.SECRETKEY_PATH
? path.join(process.env.SECRETKEY_PATH, 'settings.json')
: path.join(getUserHome(), '.flowise', 'settings.json')
await fs.promises.writeFile(defaultLocation, JSON.stringify(settings, null, 2)) await fs.promises.writeFile(defaultLocation, JSON.stringify(settings, null, 2))
return instanceId return instanceId
} }