Tidying
This commit is contained in:
parent
d9608c0ba6
commit
ae5ec38024
|
@ -88,114 +88,114 @@ function etherpad_create_database {
|
|||
}
|
||||
|
||||
function create_etherpad_settings {
|
||||
echo '{' > /var/www/$ETHERPAD_DOMAIN_NAME/htdocs/settings.json
|
||||
echo " \"title\": \"${ETHERPAD_TITLE}\"," >> /var/www/$ETHERPAD_DOMAIN_NAME/htdocs/settings.json
|
||||
echo ' "favicon": "favicon.ico",' >> /var/www/$ETHERPAD_DOMAIN_NAME/htdocs/settings.json
|
||||
settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo '{' > $settings_file
|
||||
echo " \"title\": \"${ETHERPAD_TITLE}\"," >> $settings_file
|
||||
echo ' "favicon": "favicon.ico",' >> $settings_file
|
||||
|
||||
echo ' "ip": "0.0.0.0",' >> /var/www/$ETHERPAD_DOMAIN_NAME/htdocs/settings.json
|
||||
echo " \"port\" : ${ETHERPAD_PORT}," >> /var/www/$ETHERPAD_DOMAIN_NAME/htdocs/settings.json
|
||||
echo ' "ip": "0.0.0.0",' >> $settings_file
|
||||
echo " \"port\" : ${ETHERPAD_PORT}," >> $settings_file
|
||||
|
||||
echo ' "showSettingsInAdminPage" : true,' >> /var/www/$ETHERPAD_DOMAIN_NAME/htdocs/settings.json
|
||||
echo ' "showSettingsInAdminPage" : true,' >> $settings_file
|
||||
|
||||
if [[ $ONION_ONLY == 'no' ]]; then
|
||||
echo ' "ssl" : {' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo " \"key\" : \"/etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key\"," >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo " \"cert\" : \"/etc/ssl/certs/${ETHERPAD_DOMAIN_NAME}.pem\"," >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' },' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "ssl" : {' >> $settings_file
|
||||
echo " \"key\" : \"/etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key\"," >> $settings_file
|
||||
echo " \"cert\" : \"/etc/ssl/certs/${ETHERPAD_DOMAIN_NAME}.pem\"," >> $settings_file
|
||||
echo ' },' >> $settings_file
|
||||
fi
|
||||
|
||||
echo ' "dbType" : "mysql",' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "dbSettings" : {' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "user" : "root",' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "host" : "localhost",' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo " \"password\": \"${MARIADB_PASSWORD}\"," >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "database": "etherpad",' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "charset" : "utf8mb4"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' },' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "dbType" : "mysql",' >> $settings_file
|
||||
echo ' "dbSettings" : {' >> $settings_file
|
||||
echo ' "user" : "root",' >> $settings_file
|
||||
echo ' "host" : "localhost",' >> $settings_file
|
||||
echo " \"password\": \"${MARIADB_PASSWORD}\"," >> $settings_file
|
||||
echo ' "database": "etherpad",' >> $settings_file
|
||||
echo ' "charset" : "utf8mb4"' >> $settings_file
|
||||
echo ' },' >> $settings_file
|
||||
|
||||
echo " \"defaultPadText\" : \"${ETHERPAD_WELCOME_MESSAGE}\"," >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo " \"defaultPadText\" : \"${ETHERPAD_WELCOME_MESSAGE}\"," >> $settings_file
|
||||
|
||||
echo ' "padOptions": {' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "noColors": false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "showControls": true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "showChat": true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "showLineNumbers": false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "useMonospaceFont": false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "userName": false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "userColor": true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "rtl": false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "alwaysShowChat": true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "chatAndUsers": true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "lang": "en-gb"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' },' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "padOptions": {' >> $settings_file
|
||||
echo ' "noColors": false,' >> $settings_file
|
||||
echo ' "showControls": true,' >> $settings_file
|
||||
echo ' "showChat": true,' >> $settings_file
|
||||
echo ' "showLineNumbers": false,' >> $settings_file
|
||||
echo ' "useMonospaceFont": false,' >> $settings_file
|
||||
echo ' "userName": false,' >> $settings_file
|
||||
echo ' "userColor": true,' >> $settings_file
|
||||
echo ' "rtl": false,' >> $settings_file
|
||||
echo ' "alwaysShowChat": true,' >> $settings_file
|
||||
echo ' "chatAndUsers": true,' >> $settings_file
|
||||
echo ' "lang": "en-gb"' >> $settings_file
|
||||
echo ' },' >> $settings_file
|
||||
|
||||
echo ' "suppressErrorsInPadText" : true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "suppressErrorsInPadText" : true,' >> $settings_file
|
||||
|
||||
echo ' "requireSession" : false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "requireSession" : false,' >> $settings_file
|
||||
|
||||
echo ' "editOnly" : false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "editOnly" : false,' >> $settings_file
|
||||
|
||||
echo ' "sessionNoPassword" : false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "sessionNoPassword" : false,' >> $settings_file
|
||||
|
||||
echo ' "minify" : true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "minify" : true,' >> $settings_file
|
||||
|
||||
echo ' "maxAge" : 21600, // 60 * 60 * 6 = 6 hours' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "maxAge" : 21600, // 60 * 60 * 6 = 6 hours' >> $settings_file
|
||||
|
||||
echo ' "abiword" : null,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "abiword" : null,' >> $settings_file
|
||||
|
||||
echo ' "soffice" : null,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "soffice" : null,' >> $settings_file
|
||||
|
||||
echo ' "tidyHtml" : null,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "tidyHtml" : null,' >> $settings_file
|
||||
|
||||
echo ' "allowUnknownFileEnds" : false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "allowUnknownFileEnds" : false,' >> $settings_file
|
||||
|
||||
echo ' "requireAuthentication" : true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "requireAuthentication" : true,' >> $settings_file
|
||||
|
||||
echo ' "requireAuthorization" : true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "requireAuthorization" : true,' >> $settings_file
|
||||
|
||||
echo ' "trustProxy" : false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "trustProxy" : false,' >> $settings_file
|
||||
|
||||
echo ' "disableIPlogging" : true,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "disableIPlogging" : true,' >> $settings_file
|
||||
|
||||
echo ' "users": {' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo " \"${MY_USERNAME}\": { \"password\": \"${ETHERPAD_ADMIN_PASSWORD}\", \"is_admin\": true }" >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' },' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "users": {' >> $settings_file
|
||||
echo " \"${MY_USERNAME}\": { \"password\": \"${ETHERPAD_ADMIN_PASSWORD}\", \"is_admin\": true }" >> $settings_file
|
||||
echo ' },' >> $settings_file
|
||||
|
||||
echo ' "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],' >> $settings_file
|
||||
|
||||
echo ' "loadTest": false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "loadTest": false,' >> $settings_file
|
||||
|
||||
echo ' "indentationOnNewLine": false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "indentationOnNewLine": false,' >> $settings_file
|
||||
|
||||
echo ' "toolbar": {' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "left": [' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ["bold", "italic", "underline", "strikethrough"],' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ["orderedlist", "unorderedlist", "indent", "outdent"],' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ["undo", "redo"],' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ["clearauthorship"]' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ],' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "right": [' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ["importexport", "timeslider", "savedrevision"],' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ["settings", "embed"],' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ["showusers"]' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ],' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "timeslider": [' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ["timeslider_export", "timeslider_returnToPad"]' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' ]' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' },' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "loglevel": "INFO"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo '}' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
echo ' "toolbar": {' >> $settings_file
|
||||
echo ' "left": [' >> $settings_file
|
||||
echo ' ["bold", "italic", "underline", "strikethrough"],' >> $settings_file
|
||||
echo ' ["orderedlist", "unorderedlist", "indent", "outdent"],' >> $settings_file
|
||||
echo ' ["undo", "redo"],' >> $settings_file
|
||||
echo ' ["clearauthorship"]' >> $settings_file
|
||||
echo ' ],' >> $settings_file
|
||||
echo ' "right": [' >> $settings_file
|
||||
echo ' ["importexport", "timeslider", "savedrevision"],' >> $settings_file
|
||||
echo ' ["settings", "embed"],' >> $settings_file
|
||||
echo ' ["showusers"]' >> $settings_file
|
||||
echo ' ],' >> $settings_file
|
||||
echo ' "timeslider": [' >> $settings_file
|
||||
echo ' ["timeslider_export", "timeslider_returnToPad"]' >> $settings_file
|
||||
echo ' ]' >> $settings_file
|
||||
echo ' },' >> $settings_file
|
||||
echo ' "loglevel": "INFO"' >> $settings_file
|
||||
echo '}' >> $settings_file
|
||||
}
|
||||
|
||||
function remove_user_etherpad {
|
||||
remove_username="$1"
|
||||
|
||||
read_config_param ETHERPAD_DOMAIN_NAME
|
||||
settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
|
||||
${PROJECT_NAME}-pass -u $remove_username --rmapp etherpad
|
||||
|
||||
if grep -q "\"$remove_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
|
||||
sed -i "/\"$remove_username\": {/d" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
if grep -q "\"$remove_username\": {" $settings_file; then
|
||||
sed -i "/\"$remove_username\": {/d" $settings_file
|
||||
systemctl restart etherpad
|
||||
fi
|
||||
}
|
||||
|
@ -203,11 +203,12 @@ function remove_user_etherpad {
|
|||
function add_user_etherpad {
|
||||
new_username="$1"
|
||||
new_user_password="$2"
|
||||
read_config_param ETHERPAD_DOMAIN_NAME
|
||||
if ! grep -q "\"$new_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
|
||||
settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
|
||||
if ! grep -q "\"$new_username\": {" $settings_file; then
|
||||
${PROJECT_NAME}-pass -u $new_username -a etherpad -p "$new_user_password"
|
||||
sed -i "/\"users\": {/a \"$new_username\": { \"password\": \"$new_user_password\", \"is_admin\": false }," /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
if grep -q "\"$new_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
|
||||
sed -i "/\"users\": {/a \"$new_username\": { \"password\": \"$new_user_password\", \"is_admin\": false }," $settings_file
|
||||
if grep -q "\"$new_username\": {" $settings_file; then
|
||||
systemctl restart etherpad
|
||||
else
|
||||
echo '1'
|
||||
|
|
Loading…
Reference in New Issue