diff --git a/lib/wp/private/internal-comp-loader.c b/lib/wp/private/internal-comp-loader.c index 80817b94..4a7e7b3a 100644 --- a/lib/wp/private/internal-comp-loader.c +++ b/lib/wp/private/internal-comp-loader.c @@ -739,8 +739,16 @@ wp_internal_comp_loader_load (WpComponentLoader * self, WpCore * core, profile_json = wp_conf_get_value (conf, "wireplumber.profiles", component, NULL); - if (profile_json) - wp_properties_update_from_json (profile, profile_json); + if (!profile_json) { + g_autoptr (GTask) task = g_task_new (self, cancellable, callback, data); + g_task_set_source_tag (task, wp_internal_comp_loader_load); + g_task_return_new_error (G_TASK (task), WP_DOMAIN_LIBRARY, + WP_LIBRARY_ERROR_INVALID_ARGUMENT, + "profile '%s' not found in configuration", component); + return; + } + + wp_properties_update_from_json (profile, profile_json); components = wp_conf_get_section (conf, "wireplumber.components", NULL); diff --git a/src/main.c b/src/main.c index 8f854896..a1785025 100644 --- a/src/main.c +++ b/src/main.c @@ -25,6 +25,7 @@ enum WpExitCode static gboolean show_version = FALSE; static gchar * config_file = NULL; +static gchar * profile = NULL; static GOptionEntry entries[] = { @@ -32,6 +33,8 @@ static GOptionEntry entries[] = "Show version", NULL }, { "config-file", 'c', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &config_file, "The context configuration file", NULL }, + { "profile", 'p', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &profile, + "The profile to load", NULL }, { NULL } }; @@ -151,6 +154,8 @@ main (gint argc, gchar **argv) if (!config_file) config_file = "wireplumber.conf"; + if (!profile) + profile = "main"; /* Forward WIREPLUMBER_CONFIG_DIR to PIPEWIRE_CONFIG_DIR */ conf_env = g_getenv ("WIREPLUMBER_CONFIG_DIR"); @@ -161,7 +166,7 @@ main (gint argc, gchar **argv) PW_KEY_CONFIG_NAME, config_file, PW_KEY_APP_NAME, "WirePlumber", "wireplumber.daemon", "true", - "wireplumber.profile", "main", + "wireplumber.profile", profile, NULL); /* prefer manager socket */