瀏覽代碼

Extra environment variables

Bob Mottram 6 年之前
父節點
當前提交
749f8ab283
共有 1 個檔案被更改,包括 16 行新增7 行删除
  1. 16
    7
      src/freedombone-app-hackmd

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

@@ -35,7 +35,7 @@ HACKMD_CODE=
35 35
 HACKMD_ONION_PORT=9052
36 36
 HACKMD_REPO="https://github.com/hackmdio/hackmd"
37 37
 HACKMD_COMMIT='c71361467d6eee6519b050fb5c40fc32520a19a8'
38
-HACKMD_PORT_INTERNAL=TODO
38
+HACKMD_PORT_INTERNAL=3007
39 39
 
40 40
 hackmd_variables=(ONION_ONLY
41 41
                   HACKMD_DOMAIN_NAME
@@ -301,19 +301,19 @@ function hackmd_create_config {
301 301
       echo '    "production": {';
302 302
       echo '        "domain": "localhost",';
303 303
       echo '        "hsts": {';
304
-      echo '            "enable": true,';
304
+      echo '            "enable": false,';
305 305
       echo '            "maxAgeSeconds": "31536000",';
306 306
       echo '            "includeSubdomains": true,';
307 307
       echo '            "preload": true';
308 308
       echo '        },';
309 309
       echo '        "csp": {';
310
-      echo '            "enable": true,';
310
+      echo '            "enable": false,';
311 311
       echo '            "directives": {';
312 312
       echo '            },';
313
-      echo '            "upgradeInsecureRequests": "auto",';
313
+      echo '            "upgradeInsecureRequests": "false",';
314 314
       echo '            "addDefaults": true,';
315
-      echo '            "addDisqus": true,';
316
-      echo '            "addGoogleAnalytics": true';
315
+      echo '            "addDisqus": false,';
316
+      echo '            "addGoogleAnalytics": false';
317 317
       echo '        },';
318 318
       echo '        "db": {';
319 319
       echo "            \"username\": \"root\",";
@@ -442,7 +442,10 @@ function install_hackmd {
442 442
 
443 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 450
     { echo '[Unit]';
448 451
       echo 'Description=hackmd';
@@ -458,6 +461,12 @@ function install_hackmd {
458 461
       echo 'ExecStart=/usr/local/bin/npm start';
459 462
       echo 'ExecStop=/usr/local/bin/npm stop';
460 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 470
       echo 'Restart=always';
462 471
       echo 'StandardError=syslog';
463 472
       echo '';