瀏覽代碼

Extra environment variables

Bob Mottram 6 年之前
父節點
當前提交
749f8ab283
共有 1 個文件被更改,包括 16 次插入7 次删除
  1. 16
    7
      src/freedombone-app-hackmd

+ 16
- 7
src/freedombone-app-hackmd 查看文件

35
 HACKMD_ONION_PORT=9052
35
 HACKMD_ONION_PORT=9052
36
 HACKMD_REPO="https://github.com/hackmdio/hackmd"
36
 HACKMD_REPO="https://github.com/hackmdio/hackmd"
37
 HACKMD_COMMIT='c71361467d6eee6519b050fb5c40fc32520a19a8'
37
 HACKMD_COMMIT='c71361467d6eee6519b050fb5c40fc32520a19a8'
38
-HACKMD_PORT_INTERNAL=TODO
38
+HACKMD_PORT_INTERNAL=3007
39
 
39
 
40
 hackmd_variables=(ONION_ONLY
40
 hackmd_variables=(ONION_ONLY
41
                   HACKMD_DOMAIN_NAME
41
                   HACKMD_DOMAIN_NAME
301
       echo '    "production": {';
301
       echo '    "production": {';
302
       echo '        "domain": "localhost",';
302
       echo '        "domain": "localhost",';
303
       echo '        "hsts": {';
303
       echo '        "hsts": {';
304
-      echo '            "enable": true,';
304
+      echo '            "enable": false,';
305
       echo '            "maxAgeSeconds": "31536000",';
305
       echo '            "maxAgeSeconds": "31536000",';
306
       echo '            "includeSubdomains": true,';
306
       echo '            "includeSubdomains": true,';
307
       echo '            "preload": true';
307
       echo '            "preload": true';
308
       echo '        },';
308
       echo '        },';
309
       echo '        "csp": {';
309
       echo '        "csp": {';
310
-      echo '            "enable": true,';
310
+      echo '            "enable": false,';
311
       echo '            "directives": {';
311
       echo '            "directives": {';
312
       echo '            },';
312
       echo '            },';
313
-      echo '            "upgradeInsecureRequests": "auto",';
313
+      echo '            "upgradeInsecureRequests": "false",';
314
       echo '            "addDefaults": true,';
314
       echo '            "addDefaults": true,';
315
-      echo '            "addDisqus": true,';
316
-      echo '            "addGoogleAnalytics": true';
315
+      echo '            "addDisqus": false,';
316
+      echo '            "addGoogleAnalytics": false';
317
       echo '        },';
317
       echo '        },';
318
       echo '        "db": {';
318
       echo '        "db": {';
319
       echo "            \"username\": \"root\",";
319
       echo "            \"username\": \"root\",";
442
 
442
 
443
     adduser --system --home="/etc/hackmd" --group hackmd
443
     adduser --system --home="/etc/hackmd" --group hackmd
444
 
444
 
445
-
445
+    hmd_domain="$HACKMD_DOMAIN_NAME"
446
+    if [[ "$ONION_ONLY" != 'no' ]]; then
447
+        hmd_domain="$HACKMD_ONION_HOSTNAME"
448
+    fi
446
 
449
 
447
     { echo '[Unit]';
450
     { echo '[Unit]';
448
       echo 'Description=hackmd';
451
       echo 'Description=hackmd';
458
       echo 'ExecStart=/usr/local/bin/npm start';
461
       echo 'ExecStart=/usr/local/bin/npm start';
459
       echo 'ExecStop=/usr/local/bin/npm stop';
462
       echo 'ExecStop=/usr/local/bin/npm stop';
460
       echo 'Environment=USER=hackmd';
463
       echo 'Environment=USER=hackmd';
464
+      echo 'Environment=NODE_ENV=production';
465
+      echo "Environment=HMD_DOMAIN=$hmd_domain";
466
+      echo "Environment=HMD_PORT=$HACKMD_PORT_INTERNAL";
467
+      echo 'Environment=HMD_PROTOCOL_USESSL=false';
468
+      echo 'Environment=HMD_ALLOW_ANONYMOUS=false';
469
+      echo 'Environment=HMD_ALLOW_FREEURL=true';
461
       echo 'Restart=always';
470
       echo 'Restart=always';
462
       echo 'StandardError=syslog';
471
       echo 'StandardError=syslog';
463
       echo '';
472
       echo '';