From d9c053790e8ef199161654a843aa2e631431dc58 Mon Sep 17 00:00:00 2001 From: clsr Date: Tue, 15 Nov 2016 20:25:20 +0100 Subject: Add run-gomf-modpanel.bash --- run-gomf-modpanel.bash | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 run-gomf-modpanel.bash diff --git a/run-gomf-modpanel.bash b/run-gomf-modpanel.bash new file mode 100755 index 0000000..220b06d --- /dev/null +++ b/run-gomf-modpanel.bash @@ -0,0 +1,90 @@ +#!/bin/bash + +# This software is released into public domain. +# It is provided "as is", without warranties or conditions of any kind. +# Anyone is free to modify, redistribute and do anything with this software. + +# Simple startup/configuration script for gomf-modpanel +# Leave options blank ("OPTION=", "OPTION=''") or comment them out to use +# gomf-modpanel defaults (see `gomf-modpanel --help`) + +set -e + +############################################################################### + + +# The gomf-modpanel binary +#GOMF_MODPANEL_BIN=gomf-modpanel + +# Root folder for Gomf containing gomf-modpanel-web files +# +# Defaults to current directory if not set. +#GOMF_MODPANEL_ROOT=~/www/gomf-modpanel-web + +# Root folder for Gomf containing gomf-web files +# +# Defaults to current directory if not set. +#GOMF_ROOT=~/www/gomf-web/ + +# URL path prefix to serve modpanel under +#URL_PREFIX=/mod/ + +# URL path to deletion log +#DELETION_LOG=/deleted + +# The URL that Gomf serves uploaded files on +# +# Defaults to /u/ +#UPLOAD_URL=https://u.example.com/ + +# The host to listen on for HTTP and/or HTTPS +# +# Use 'localhost' if using local reverse proxy, 0.0.0.0 to listen to any host +# or a specific hostname to only allow connections to that address. +#LISTEN_HOST=localhost + +# The port to listen on for HTTP +# +# 80 for a standard HTTP server, probably a higher port (e.g. 9000) if +# reverse-proxied. +#HTTP_PORT=8080 + +# The port to listen on for HTTPS +# +# 443 for a standard HTTPS server. Requires TLS_CERT and TLS_KEY +#HTTPS_PORT=8443 + +# SSL certificate for HTTPS +#TLS_CERT=cert.pem + +# SSL certificate key for HTTPS +#TLS_KEY=key.pem + +# List of usernames and passwords that can access the mod panel +# +# Entries should be in the form "user:password" +#ACCESS=( +# test:test +#) + + +############################################################################### + +flags=() +[ -n "$GOMF_MODPANEL_ROOT" ] && cd "$GOMF_MODPANEL_ROOT" +[ -n "$GOMF_ROOT" ] && flags+=(--gomf-root "$GOMF_ROOT") +[ -n "$URL_PREFIX" ] && flags+=(--prefix "$URL_PREFIX") +[ -n "$DELETION_LOG" ] && flags+=(--deletion-log "$DELETION_LOG") +[ -n "$UPLOAD_URL" ] && flags+=(--upload-url "$UPLOAD_URL") +[ -n "$HTTP_PORT" ] && flags+=(--http "${HTTP_HOST:-localhost}:$HTTP_PORT") +[ -n "$HTTPS_PORT" ] && [ -n "$TLS_CERT" ] && [ -n "$TLS_KEY" ] && flags+=( + --https "${HTTP_HOST:-localhost}:$HTTPS_PORT" + --cert "$TLS_CERT" --key "$TLS_KEY") +oldifs="$IFS" IFS=, +[ -n "$ACCESS[*]" ] && flags+=(--access "${ACCESS[*]}") +IFS="$oldifs" + +printf "%s" "${GOMF_MODPANEL_BIN:-gomf-modpanel}" +[ "${#flags}" -gt 0 ] && printf " \"%s\"" "${flags[@]}" +printf "\n" +exec "${GOMF_MODPANEL_BIN:-gomf-modpanel}" "${flags[@]}" -- cgit