mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-25 14:06:27 +00:00
if a hostname is not specified, connect over a unix socket instead of
connecting to localhost (issue #7145, Mithraen) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@28897 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -222,8 +222,8 @@ static int process_my_load_module(struct ast_config *cfg)
|
|||||||
|
|
||||||
tmp = ast_variable_retrieve(cfg,"global","hostname");
|
tmp = ast_variable_retrieve(cfg,"global","hostname");
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
ast_log(LOG_WARNING,"PostgreSQL server hostname not specified. Assuming localhost\n");
|
ast_log(LOG_WARNING,"PostgreSQL server hostname not specified. Assuming unix socket connection\n");
|
||||||
tmp = "localhost";
|
tmp = ""; /* connect via UNIX-socket by default */
|
||||||
}
|
}
|
||||||
pghostname = strdup(tmp);
|
pghostname = strdup(tmp);
|
||||||
if (pghostname == NULL) {
|
if (pghostname == NULL) {
|
||||||
@@ -287,10 +287,11 @@ static int process_my_load_module(struct ast_config *cfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (option_debug) {
|
if (option_debug) {
|
||||||
|
if (ast_strlen_zero(pghostname))
|
||||||
|
ast_log(LOG_DEBUG, "cdr_pgsql: using default unix socket\n");
|
||||||
|
else
|
||||||
ast_log(LOG_DEBUG, "cdr_pgsql: got hostname of %s\n", pghostname);
|
ast_log(LOG_DEBUG, "cdr_pgsql: got hostname of %s\n", pghostname);
|
||||||
ast_log(LOG_DEBUG, "cdr_pgsql: got port of %s\n", pgdbport);
|
ast_log(LOG_DEBUG, "cdr_pgsql: got port of %s\n", pgdbport);
|
||||||
if (pgdbsock)
|
|
||||||
ast_log(LOG_DEBUG, "cdr_pgsql: got sock file of %s\n", pgdbsock);
|
|
||||||
ast_log(LOG_DEBUG, "cdr_pgsql: got user of %s\n", pgdbuser);
|
ast_log(LOG_DEBUG, "cdr_pgsql: got user of %s\n", pgdbuser);
|
||||||
ast_log(LOG_DEBUG, "cdr_pgsql: got dbname of %s\n", pgdbname);
|
ast_log(LOG_DEBUG, "cdr_pgsql: got dbname of %s\n", pgdbname);
|
||||||
ast_log(LOG_DEBUG, "cdr_pgsql: got password of %s\n", pgpassword);
|
ast_log(LOG_DEBUG, "cdr_pgsql: got password of %s\n", pgpassword);
|
||||||
|
|||||||
Reference in New Issue
Block a user