Extra environment variables

This commit is contained in:
Bob Mottram 2018-05-21 14:24:55 +01:00
parent d592ad2619
commit 749f8ab283
1 changed files with 16 additions and 7 deletions

View File

@ -35,7 +35,7 @@ HACKMD_CODE=
HACKMD_ONION_PORT=9052
HACKMD_REPO="https://github.com/hackmdio/hackmd"
HACKMD_COMMIT='c71361467d6eee6519b050fb5c40fc32520a19a8'
HACKMD_PORT_INTERNAL=TODO
HACKMD_PORT_INTERNAL=3007
hackmd_variables=(ONION_ONLY
HACKMD_DOMAIN_NAME
@ -301,19 +301,19 @@ function hackmd_create_config {
echo ' "production": {';
echo ' "domain": "localhost",';
echo ' "hsts": {';
echo ' "enable": true,';
echo ' "enable": false,';
echo ' "maxAgeSeconds": "31536000",';
echo ' "includeSubdomains": true,';
echo ' "preload": true';
echo ' },';
echo ' "csp": {';
echo ' "enable": true,';
echo ' "enable": false,';
echo ' "directives": {';
echo ' },';
echo ' "upgradeInsecureRequests": "auto",';
echo ' "upgradeInsecureRequests": "false",';
echo ' "addDefaults": true,';
echo ' "addDisqus": true,';
echo ' "addGoogleAnalytics": true';
echo ' "addDisqus": false,';
echo ' "addGoogleAnalytics": false';
echo ' },';
echo ' "db": {';
echo " \"username\": \"root\",";
@ -442,7 +442,10 @@ function install_hackmd {
adduser --system --home="/etc/hackmd" --group hackmd
hmd_domain="$HACKMD_DOMAIN_NAME"
if [[ "$ONION_ONLY" != 'no' ]]; then
hmd_domain="$HACKMD_ONION_HOSTNAME"
fi
{ echo '[Unit]';
echo 'Description=hackmd';
@ -458,6 +461,12 @@ function install_hackmd {
echo 'ExecStart=/usr/local/bin/npm start';
echo 'ExecStop=/usr/local/bin/npm stop';
echo 'Environment=USER=hackmd';
echo 'Environment=NODE_ENV=production';
echo "Environment=HMD_DOMAIN=$hmd_domain";
echo "Environment=HMD_PORT=$HACKMD_PORT_INTERNAL";
echo 'Environment=HMD_PROTOCOL_USESSL=false';
echo 'Environment=HMD_ALLOW_ANONYMOUS=false';
echo 'Environment=HMD_ALLOW_FREEURL=true';
echo 'Restart=always';
echo 'StandardError=syslog';
echo '';