diff --git a/planemo/galaxy/config.py b/planemo/galaxy/config.py index d0e85f981..79f137437 100644 --- a/planemo/galaxy/config.py +++ b/planemo/galaxy/config.py @@ -36,6 +36,7 @@ from packaging.version import parse as parse_version from planemo import git +from planemo import network_util from planemo.config import OptionSource from planemo.database import postgres_singularity from planemo.deps import ensure_dependency_resolvers_conf_configured @@ -426,6 +427,7 @@ def config_join(*args): if kwds.get("mulled_containers", False): properties["mulled_channels"] = kwds.get("conda_ensure_channels", "") + _handle_kwd_overrides(properties, kwds) # TODO: consider following property @@ -488,23 +490,49 @@ def write_galaxy_config(galaxy_root, properties, env, kwds, template_args, confi env["GRAVITY_STATE_DIR"] = config_join("gravity") with NamedTemporaryFile(suffix=".sock", delete=True) as nt: env["SUPERVISORD_SOCKET"] = nt.name + # Enable GxITs by default + gx_it_port = network_util.get_free_port() + properties.update( + dict( + interactivetools_enable="true", + galaxy_infrastructure_url=f"http://localhost:{template_args['port']}", + interactivetools_upstream_proxy="false", + interactivetools_proxy_host=f"localhost:{gx_it_port}", + ) + ) + gx_it_config = dict( + enable="true", + port=gx_it_port, + ) + if kwds.get("disable_gxits", True): + properties.update( + dict( + interactivetools_enable="false", + ) + ) + gx_it_config.update( + dict( + enable="false", + ) + ) + config = { + "galaxy": properties, + "gravity": { + "galaxy_root": galaxy_root, + "gunicorn": { + "bind": f"{kwds.get('host', 'localhost')}:{template_args['port']}", + "preload": "false", + }, + "gx_it_proxy": gx_it_config, + }, + } + if kwds.get("enable_gxits", True): + config["gravity"]["gx_it_proxy"].update({ + "enable": True, + "port": "4002", + }) write_file( - env["GALAXY_CONFIG_FILE"], - json.dumps( - { - "galaxy": properties, - "gravity": { - "galaxy_root": galaxy_root, - "gunicorn": { - "bind": f"{kwds.get('host', 'localhost')}:{template_args['port']}", - "preload": False, - }, - "gx_it_proxy": { - "enable": False, - }, - }, - } - ), + env["GALAXY_CONFIG_FILE"], json.dumps(config) ) diff --git a/planemo/options.py b/planemo/options.py index 5044a7b74..56b1cfb4d 100644 --- a/planemo/options.py +++ b/planemo/options.py @@ -1421,6 +1421,7 @@ def galaxy_serve_options(): install_prebuilt_client_option(), skip_client_build_option(), shed_install_option(), + disable_interactive_tools(), ) @@ -2257,3 +2258,14 @@ def job_config_init_options(): runner_target_option(), galaxy_version_option(), ) + + +def disable_interactive_tools(): + return planemo_option( + "--disable_gxits", + is_flag=True, + default=False, + help=( + "Configure Galaxy to disable interactive tools." + ), + )