Commit 8bb793cb authored by Philip Carns's avatar Philip Carns
Browse files

add show config fn and use in daemon

parent a52946cd
......@@ -128,6 +128,14 @@ int bake_provider_count_storage_targets(bake_provider_t provider,
int bake_provider_list_storage_targets(bake_provider_t provider,
bake_target_id_t* targets);
/**
* Retrieves complete configuration of bake provider, encoded as json
*
* @param [in] provider bake provider
* @returns null terminated string that must be free'd by caller
*/
char* bake_provider_get_config(bake_provider_t provider);
#ifdef __cplusplus
}
#endif
......
......@@ -158,6 +158,7 @@ int main(int argc, char** argv)
bake_target_id_t tid;
struct bake_provider_init_info bpargs = {0};
char json_config[256] = {0};
char* show_conf = NULL;
if (opts.pipeline_enabled) {
sprintf(json_config, "{\"pipeline_enable\": true}");
......@@ -183,6 +184,11 @@ int main(int argc, char** argv)
printf("Provider %d managing new target at multiplex id %d\n", i,
i + 1);
printf("Bake provider config:\n");
printf("=====================\n");
show_conf = bake_provider_get_config(provider);
printf("%s\n", show_conf);
free(show_conf);
}
} else {
......@@ -191,6 +197,7 @@ int main(int argc, char** argv)
bake_provider_t provider;
struct bake_provider_init_info bpargs = {0};
char json_config[256] = {0};
char* show_conf = NULL;
if (opts.pipeline_enabled) {
sprintf(json_config, "{\"pipeline_enable\": true}");
......@@ -218,6 +225,11 @@ int main(int argc, char** argv)
printf("Provider 0 managing new target at multiplex id %d\n", 1);
}
printf("Bake provider config:\n");
printf("=====================\n");
show_conf = bake_provider_get_config(provider);
printf("%s\n", show_conf);
free(show_conf);
}
/* suspend until the BAKE server gets a shutdown signal from the client */
......
......@@ -1071,3 +1071,11 @@ static int validate_and_complete_config(struct json_object* _config,
return (0);
}
char* bake_provider_get_config(bake_provider_t provider)
{
const char* content = json_object_to_json_string_ext(
provider->json_cfg,
JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE);
return strdup(content);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment