# HG changeset patch # User Franz Glasner # Date 1573980923 -3600 # Node ID f85a4096574d236441d14e03070aeb25f82ce2c1 # Parent 87c0189b3437b0ca9e5b09b665cb8ff9b6000cee FIX: Figure out the type of configuration file and provide the correct option flag for it: --ini, --xml, --json, --yaml diff -r 87c0189b3437 -r f85a4096574d uwsginl/files/uwsginl.in --- a/uwsginl/files/uwsginl.in Sun Nov 17 09:54:40 2019 +0100 +++ b/uwsginl/files/uwsginl.in Sun Nov 17 09:55:23 2019 +0100 @@ -67,12 +67,37 @@ return 1 } +# Echo name of uWSGI option for handling of configuration file with given +# extension. +get_config_filetype() +{ + case "$1" in + *.ini) + echo ini + ;; + *.json|*.js) + echo json + ;; + *.xml) + echo xml + ;; + *.yaml|*.yml) + echo yaml + ;; + *) + warn "Unknown configuration file type for \`$1'" + echo ini + return 1 + ;; + esac +} + if [ -n "${uwsginl_profiles}" ]; then if [ -n "$2" ]; then profile="$2" if ! is_uwsginl_profile $profile; then echo "$0: no such profile defined in uwsginl_profiles." - exit 1 + exit 1 fi eval uwsginl_configfile=\${uwsginl_${profile}_configfile:-"%%PREFIX%%/etc/uwsginl/uwsginl-${profile}.ini"} eval uwsginl_logfile=\${uwsginl_${profile}_logfile:-"/var/log/${name}-${profile}.log"} @@ -102,22 +127,20 @@ start_precmd() { - rc_flags="" - if checkyesno uwsginl_emperor; then echo "Running uWSGI as Emperor. Vassals loaded from "$uwsginl_vassals_dir required_dirs=${uwsginl_vassals_dir} - rc_flags=${rc_flags}"--emperor-pidfile ${uwsginl_pidfile} -d ${uwsginl_logfile} --emperor ${uwsginl_vassals_dir}" + rc_flags="--emperor-pidfile ${uwsginl_pidfile} --daemonize ${uwsginl_logfile} --emperor ${uwsginl_vassals_dir}" rc_flags=${rc_flags}" --vassals-set uid=${uwsginl_uid} --vassals-set gid=${uwsginl_gid}" else - rc_flags=${rc_flags}"--master --uid ${uwsginl_uid} --gid ${uwsginl_gid} --pidfile ${uwsginl_pidfile} -d ${uwsginl_logfile}" + rc_flags="--master --uid ${uwsginl_uid} --gid ${uwsginl_gid} --pidfile ${uwsginl_pidfile} --daemonize ${uwsginl_logfile}" fi rc_flags=${rc_flags}" ${uwsginl_flags}" # put the configfile last so that all given options can be overwritten if [ -e ${uwsginl_configfile} ]; then - rc_flags=${rc_flags}" --ini ${uwsginl_configfile} " + rc_flags=${rc_flags}" --$(get_config_filetype "${uwsginl_configfile}") ${uwsginl_configfile}" fi }