def configure_integration(path):
    """Configure and enable an integration."""
    integration = register_integration(path)
    integration_args = {}
    try:
        with open(os.path.join(path, ARGS_JSON)) as f:
            integration_args = json.loads(f.read())
    except Exception as exc:
        logger.debug(str(exc), exc_info=True)
        raise click.ClickException("Cannot load {} integration args, please configure it first."
                                   .format(os.path.basename(path)))

    click.secho("[*] Adding integration {}".format(integration.name))
    logger.debug("Adding integration %s", integration.name,
                 extra={"integration": integration.name, "args": integration_args})
    configured_integration = ConfiguredIntegration(name=integration.name, integration=integration, path=path)
    configured_integration.data = integration_args
    configured_integration.integration.module = get_integration_module(path).IntegrationActionsClass(integration_args)

    configured_integrations.append(configured_integration)
Configure and enable an integration.