浏览代码

Update README

Nicolas Meienberger 3 年之前
父节点
当前提交
4c148a58e0

+ 1 - 0
README.md

@@ -24,6 +24,7 @@ Check our demo instance : **95.179.210.152** / username: **user@runtipi.com** /
 - [Calibre-Web](https://github.com/janeczku/calibre-web) - Web Ebook Reader
 - [Calibre-Web](https://github.com/janeczku/calibre-web) - Web Ebook Reader
 - [Code-Server](https://github.com/coder/code-server) - Web VS Code 
 - [Code-Server](https://github.com/coder/code-server) - Web VS Code 
 - [Filebrowser](https://github.com/filebrowser/filebrowser) - Web File Browser
 - [Filebrowser](https://github.com/filebrowser/filebrowser) - Web File Browser
+- [Firefly III](https://github.com/firefly-iii/firefly-iii) - A personal finances manager 
 - [Freshrss](https://github.com/FreshRSS/FreshRSS) - A free, self-hostable RSS aggregator
 - [Freshrss](https://github.com/FreshRSS/FreshRSS) - A free, self-hostable RSS aggregator
 - [Gitea](https://github.com/go-gitea/gitea) - Gitea - A painless self-hosted Git service
 - [Gitea](https://github.com/go-gitea/gitea) - Gitea - A painless self-hosted Git service
 - [Homarr](https://github.com/ajnart/homarr) - A homepage for your server
 - [Homarr](https://github.com/ajnart/homarr) - A homepage for your server

+ 7 - 0
apps/firefly-iii/config.json

@@ -23,6 +23,13 @@
       "max": 32,
       "max": 32,
       "label": "Random key",
       "label": "Random key",
       "env_variable": "APP_KEY"
       "env_variable": "APP_KEY"
+    },
+    {
+      "type": "random",
+      "min": 32,
+      "max": 32,
+      "label": "Database password",
+      "env_variable": "MYSQL_PASSWORD"
     }
     }
   ]
   ]
 }
 }

+ 2 - 2
apps/firefly-iii/docker-compose.yml

@@ -25,7 +25,7 @@ services:
       - DB_PORT=3306
       - DB_PORT=3306
       - DB_DATABASE=firefly
       - DB_DATABASE=firefly
       - DB_USERNAME=firefly
       - DB_USERNAME=firefly
-      - DB_PASSWORD=firefly
+      - DB_PASSWORD=${MYSQL_PASSWORD}
 
 
       # Cookie settings
       # Cookie settings
       - COOKIE_PATH="/"
       - COOKIE_PATH="/"
@@ -51,7 +51,7 @@ services:
     environment:
     environment:
       - MYSQL_RANDOM_ROOT_PASSWORD=yes
       - MYSQL_RANDOM_ROOT_PASSWORD=yes
       - MYSQL_USER=firefly
       - MYSQL_USER=firefly
-      - MYSQL_PASSWORD=firefly
+      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
       - MYSQL_DATABASE=firefly
       - MYSQL_DATABASE=firefly
     volumes:
     volumes:
       - ${APP_DATA_DIR}/data/db:/var/lib/mysql
       - ${APP_DATA_DIR}/data/db:/var/lib/mysql

+ 8 - 3
packages/system-api/src/modules/apps/apps.helpers.ts

@@ -95,6 +95,7 @@ export const generateEnvFile = (appName: string, form: Record<string, string>) =
   const configFile: AppInfo = readJsonFile(`/apps/${appName}/config.json`);
   const configFile: AppInfo = readJsonFile(`/apps/${appName}/config.json`);
   const baseEnvFile = readFile('/.env').toString();
   const baseEnvFile = readFile('/.env').toString();
   let envFile = `${baseEnvFile}\nAPP_PORT=${configFile.port}\n`;
   let envFile = `${baseEnvFile}\nAPP_PORT=${configFile.port}\n`;
+  const envMap = getEnvMap(appName);
 
 
   configFile.form_fields?.forEach((field) => {
   configFile.form_fields?.forEach((field) => {
     const formValue = form[field.env_variable];
     const formValue = form[field.env_variable];
@@ -103,10 +104,14 @@ export const generateEnvFile = (appName: string, form: Record<string, string>) =
     if (formValue) {
     if (formValue) {
       envFile += `${envVar}=${formValue}\n`;
       envFile += `${envVar}=${formValue}\n`;
     } else if (field.type === 'random') {
     } else if (field.type === 'random') {
-      const length = field.min || 32;
-      const randomString = getEntropy(field.env_variable, length);
+      if (envMap.has(envVar)) {
+        envFile += `${envVar}=${envMap.get(envVar)}\n`;
+      } else {
+        const length = field.min || 32;
+        const randomString = getEntropy(field.env_variable, length);
 
 
-      envFile += `${envVar}=${randomString}\n`;
+        envFile += `${envVar}=${randomString}\n`;
+      }
     } else if (field.required) {
     } else if (field.required) {
       throw new Error(`Variable ${field.env_variable} is required`);
       throw new Error(`Variable ${field.env_variable} is required`);
     }
     }