mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Introduce uwsgi component to manage uWSGI configuration
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
4100d36381
commit
862d87920a
7 files changed
+173
-28
No files matched your search
@@ -46,6 +46,14 @@ def parse_arguments():
|
||||
subparser.add_argument('--name',
|
||||
help='Name of the site/config/module to disable')
|
||||
subparser.add_argument('--kind', choices=['site', 'config', 'module'])
|
||||
subparser = subparsers.add_parser(
|
||||
'uwsgi-enable', help='Enable a site/config/module in UWSGI')
|
||||
subparser.add_argument('--name',
|
||||
help='Name of the site/config/module to enable')
|
||||
subparser = subparsers.add_parser(
|
||||
'uwsgi-disable', help='Disable a site/config/module in UWSGI')
|
||||
subparser.add_argument('--name',
|
||||
help='Name of the site/config/module to disable')
|
||||
|
||||
subparsers.required = True
|
||||
return parser.parse_args()
|
||||
@@ -177,6 +185,16 @@ def subcommand_disable(arguments):
|
||||
action_utils.webserver_disable(arguments.name, arguments.kind)
|
||||
|
||||
|
||||
def subcommand_uwsgi_enable(arguments):
|
||||
"""Enable uWSGI configuration and reload."""
|
||||
action_utils.uwsgi_enable(arguments.name)
|
||||
|
||||
|
||||
def subcommand_uwsgi_disable(arguments):
|
||||
"""Disable uWSGI configuration and reload."""
|
||||
action_utils.uwsgi_disable(arguments.name)
|
||||
|
||||
|
||||
def main():
|
||||
"""Parse arguments and perform all duties"""
|
||||
arguments = parse_arguments()
|
||||
|
||||
+2
-4
@@ -128,7 +128,6 @@ def subcommand_enable(_):
|
||||
if not os.path.exists(COLLECTIONS_PATH):
|
||||
os.makedirs(COLLECTIONS_PATH)
|
||||
action_utils.service_disable('radicale')
|
||||
action_utils.uwsgi_enable('radicale')
|
||||
else:
|
||||
action_utils.service_enable('radicale')
|
||||
action_utils.service_restart('radicale')
|
||||
@@ -136,9 +135,8 @@ def subcommand_enable(_):
|
||||
|
||||
def subcommand_disable(_):
|
||||
"""Stop service."""
|
||||
if radicale.get_package_version() >= radicale.VERSION_2:
|
||||
action_utils.uwsgi_disable('radicale')
|
||||
else:
|
||||
package_version = radicale.get_package_version()
|
||||
if package_version and package_version < radicale.VERSION_2:
|
||||
action_utils.service_disable('radicale')
|
||||
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||
|
||||
subparsers.add_parser('enable', help='Enable Searx')
|
||||
subparsers.add_parser('disable', help='Disable Searx')
|
||||
subparsers.add_parser(
|
||||
'setup', help='Perform post-installation operations for Searx')
|
||||
|
||||
@@ -157,16 +155,6 @@ def subcommand_setup(_):
|
||||
action_utils.service_restart('uwsgi')
|
||||
|
||||
|
||||
def subcommand_enable(_):
|
||||
"""Enable web configuration and reload."""
|
||||
action_utils.uwsgi_enable('searx')
|
||||
|
||||
|
||||
def subcommand_disable(_):
|
||||
"""Disable web configuration and reload."""
|
||||
action_utils.uwsgi_disable('searx')
|
||||
|
||||
|
||||
def subcommand_enable_public_access(_):
|
||||
"""Enable public access to the SearX application."""
|
||||
open(PUBLIC_ACCESS_SETTING_FILE, 'w').close()
|
||||
|
||||
Reference in new issue
Block a user