Skip to content

Commit

Permalink
read gearmand address:port from an environment variable CONFIG_GEARMA… (
Browse files Browse the repository at this point in the history
#153)

read gearmand address:port from an environment variable CONFIG_GEARMAND_PORT

make the CONFIG_GEARMAND_PORT a fallback if there is no -H
  • Loading branch information
lausser committed Aug 14, 2020
1 parent 063c4b4 commit 3c98162
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/gearman_top.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ double opt_interval = 0;

char * server_list[GM_LISTSIZE];
int server_list_num = 0;
char *env_server;
char * version_saved = NULL;
WINDOW *w;

Expand Down Expand Up @@ -90,8 +91,13 @@ int main (int argc, char **argv) {
}
mod_gm_opt->debug_level = opt_verbose;
mod_gm_opt->logmode = GM_LOG_MODE_TOOLS;
if(server_list_num == 0)
server_list[server_list_num++] = "localhost";
if(server_list_num == 0) {
if((env_server = getenv("CONFIG_GEARMAND_PORT")) != NULL) {
server_list[server_list_num++] = env_server;
} else {
server_list[server_list_num++] = "localhost";
}
}
server_list[server_list_num] = NULL;

signal(SIGINT, clean_exit);
Expand Down

0 comments on commit 3c98162

Please sign in to comment.