def get_plugin_configuration(plugin_ref) -> Response: """ Endpoint for getting a plugin's configuration """ project = Project.find() plugins_service = ProjectPluginsService(project) plugin = plugins_service.get_plugin(plugin_ref) settings = PluginSettingsService(project, plugin, plugins_service=plugins_service, show_hidden=False) try: settings_group_validation = plugin.settings_group_validation except PluginNotFoundError: settings_group_validation = [] return jsonify({ **get_config_with_metadata(settings), "settings": Canonical.as_canonical(settings.definitions(extras=False)), "settings_group_validation": settings_group_validation, })
def get_plugin_configuration(plugin_ref) -> Response: """ Endpoint for getting a plugin's configuration profiles """ project = Project.find() settings = PluginSettingsService(project, show_hidden=False) plugin = ConfigService(project).get_plugin(plugin_ref) discovery_service = PluginDiscoveryService(project) try: plugin_def = discovery_service.find_plugin(plugin.type, plugin.name) settings_group_validation = plugin_def.settings_group_validation except PluginNotFoundError: settings_group_validation = [] profiles = settings.profiles_with_config(db.session, plugin, redacted=True) for profile in profiles: freeze_profile_config_keys(profile) return jsonify({ "profiles": profiles, "settings": Canonical.as_canonical(settings.definitions(plugin)), "settings_group_validation": settings_group_validation, })