mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Add pg-user option.
Specifies the database user name when connecting to PostgreSQL. If not specified pgBackRest will connect with the local OS user or PGUSER, which was the previous behavior.
This commit is contained in:
parent
9452084dd1
commit
dc1e7ca22d
@ -360,6 +360,8 @@ use constant CFGOPT_PG_PORT => CFGDEF_PR
|
||||
push @EXPORT, qw(CFGOPT_PG_PORT);
|
||||
use constant CFGOPT_PG_SOCKET_PATH => CFGDEF_PREFIX_PG . '-socket-path';
|
||||
push @EXPORT, qw(CFGOPT_PG_SOCKET_PATH);
|
||||
use constant CFGOPT_PG_USER => CFGDEF_PREFIX_PG . '-user';
|
||||
push @EXPORT, qw(CFGOPT_PG_USER);
|
||||
|
||||
####################################################################################################################################
|
||||
# Option values - for options that have a specific list of allowed values
|
||||
@ -2537,6 +2539,29 @@ my %hConfigDefine =
|
||||
'db?-socket-path' => {&CFGDEF_RESET => false},
|
||||
},
|
||||
},
|
||||
|
||||
&CFGOPT_PG_USER =>
|
||||
{
|
||||
&CFGDEF_SECTION => CFGDEF_SECTION_STANZA,
|
||||
&CFGDEF_TYPE => CFGDEF_TYPE_STRING,
|
||||
&CFGDEF_PREFIX => CFGDEF_PREFIX_PG,
|
||||
&CFGDEF_INDEX_TOTAL => CFGDEF_INDEX_PG,
|
||||
&CFGDEF_REQUIRED => false,
|
||||
&CFGDEF_COMMAND =>
|
||||
{
|
||||
&CFGCMD_BACKUP => {},
|
||||
&CFGCMD_CHECK => {},
|
||||
&CFGCMD_LOCAL => {},
|
||||
&CFGCMD_REMOTE => {},
|
||||
&CFGCMD_STANZA_CREATE => {},
|
||||
&CFGCMD_STANZA_DELETE => {},
|
||||
&CFGCMD_STANZA_UPGRADE => {},
|
||||
},
|
||||
&CFGDEF_DEPEND =>
|
||||
{
|
||||
&CFGDEF_DEPEND_OPTION => CFGOPT_PG_PATH
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
####################################################################################################################################
|
||||
|
@ -829,6 +829,15 @@
|
||||
<example>/var/run/postgresql</example>
|
||||
</config-key>
|
||||
|
||||
<!-- CONFIG - STANZA SECTION - PG-USER KEY -->
|
||||
<config-key id="pg-user" name="PostgreSQL Database User">
|
||||
<summary><postgres/> database user.</summary>
|
||||
|
||||
<text>The database user name used when connecting to <postgres/>. If not specified <backrest/> will connect with the local OS user or <id>PGUSER</id>.</text>
|
||||
|
||||
<example>backupuser</example>
|
||||
</config-key>
|
||||
|
||||
<!-- CONFIG - STANZA SECTION - PG-HOST-PORT KEY -->
|
||||
<config-key id="pg-host-port" name="PostgreSQL Host Port">
|
||||
<summary><postgres/> host port when <setting>pg-host</setting> is set.</summary>
|
||||
|
@ -26,6 +26,16 @@
|
||||
<release-item>
|
||||
<p><backrest/> is now pure <proper>C</proper>.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="mike.palmiotto"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Add <br-option>pg-user</br-option> option.</p>
|
||||
|
||||
<p>Specifies the database user name when connecting to <postgres/>. If not specified <backrest/> will connect with the local OS user or <id>PGUSER</id>, which was the previous behavior.</p>
|
||||
</release-item>
|
||||
</release-feature-list>
|
||||
|
||||
<release-improvement-list>
|
||||
@ -7848,6 +7858,11 @@
|
||||
<contributor-id type="github">M1hacka</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="mike.palmiotto">
|
||||
<contributor-name-display>Mike Palmiotto</contributor-name-display>
|
||||
<contributor-id type="github">mpalmi</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="milosz.suchy">
|
||||
<contributor-name-display>Milosz Suchy</contributor-name-display>
|
||||
<contributor-id type="github">Yuxael</contributor-id>
|
||||
|
@ -252,6 +252,14 @@ sub libcAutoExportTag
|
||||
'CFGOPT_PG_SOCKET_PATH6',
|
||||
'CFGOPT_PG_SOCKET_PATH7',
|
||||
'CFGOPT_PG_SOCKET_PATH8',
|
||||
'CFGOPT_PG_USER',
|
||||
'CFGOPT_PG_USER2',
|
||||
'CFGOPT_PG_USER3',
|
||||
'CFGOPT_PG_USER4',
|
||||
'CFGOPT_PG_USER5',
|
||||
'CFGOPT_PG_USER6',
|
||||
'CFGOPT_PG_USER7',
|
||||
'CFGOPT_PG_USER8',
|
||||
'CFGOPT_PROCESS',
|
||||
'CFGOPT_PROCESS_MAX',
|
||||
'CFGOPT_PROTOCOL_TIMEOUT',
|
||||
|
@ -419,6 +419,14 @@ STRING_EXTERN(CFGOPT_PG5_SOCKET_PATH_STR, CFGOPT_PG5_S
|
||||
STRING_EXTERN(CFGOPT_PG6_SOCKET_PATH_STR, CFGOPT_PG6_SOCKET_PATH);
|
||||
STRING_EXTERN(CFGOPT_PG7_SOCKET_PATH_STR, CFGOPT_PG7_SOCKET_PATH);
|
||||
STRING_EXTERN(CFGOPT_PG8_SOCKET_PATH_STR, CFGOPT_PG8_SOCKET_PATH);
|
||||
STRING_EXTERN(CFGOPT_PG1_USER_STR, CFGOPT_PG1_USER);
|
||||
STRING_EXTERN(CFGOPT_PG2_USER_STR, CFGOPT_PG2_USER);
|
||||
STRING_EXTERN(CFGOPT_PG3_USER_STR, CFGOPT_PG3_USER);
|
||||
STRING_EXTERN(CFGOPT_PG4_USER_STR, CFGOPT_PG4_USER);
|
||||
STRING_EXTERN(CFGOPT_PG5_USER_STR, CFGOPT_PG5_USER);
|
||||
STRING_EXTERN(CFGOPT_PG6_USER_STR, CFGOPT_PG6_USER);
|
||||
STRING_EXTERN(CFGOPT_PG7_USER_STR, CFGOPT_PG7_USER);
|
||||
STRING_EXTERN(CFGOPT_PG8_USER_STR, CFGOPT_PG8_USER);
|
||||
STRING_EXTERN(CFGOPT_PROCESS_STR, CFGOPT_PROCESS);
|
||||
STRING_EXTERN(CFGOPT_PROCESS_MAX_STR, CFGOPT_PROCESS_MAX);
|
||||
STRING_EXTERN(CFGOPT_PROTOCOL_TIMEOUT_STR, CFGOPT_PROTOCOL_TIMEOUT);
|
||||
@ -1407,6 +1415,70 @@ static ConfigOptionData configOptionData[CFG_OPTION_TOTAL] = CONFIG_OPTION_LIST
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgSocketPath)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_PG1_USER)
|
||||
CONFIG_OPTION_INDEX(0)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgUser)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_PG2_USER)
|
||||
CONFIG_OPTION_INDEX(1)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgUser)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_PG3_USER)
|
||||
CONFIG_OPTION_INDEX(2)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgUser)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_PG4_USER)
|
||||
CONFIG_OPTION_INDEX(3)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgUser)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_PG5_USER)
|
||||
CONFIG_OPTION_INDEX(4)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgUser)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_PG6_USER)
|
||||
CONFIG_OPTION_INDEX(5)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgUser)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_PG7_USER)
|
||||
CONFIG_OPTION_INDEX(6)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgUser)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_PG8_USER)
|
||||
CONFIG_OPTION_INDEX(7)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptPgUser)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
|
@ -147,6 +147,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_PG1_PORT_STR);
|
||||
#define CFGOPT_PG1_SOCKET_PATH "pg1-socket-path"
|
||||
STRING_DECLARE(CFGOPT_PG1_SOCKET_PATH_STR);
|
||||
#define CFGOPT_PG1_USER "pg1-user"
|
||||
STRING_DECLARE(CFGOPT_PG1_USER_STR);
|
||||
#define CFGOPT_PG2_HOST "pg2-host"
|
||||
STRING_DECLARE(CFGOPT_PG2_HOST_STR);
|
||||
#define CFGOPT_PG2_HOST_CMD "pg2-host-cmd"
|
||||
@ -167,6 +169,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_PG2_PORT_STR);
|
||||
#define CFGOPT_PG2_SOCKET_PATH "pg2-socket-path"
|
||||
STRING_DECLARE(CFGOPT_PG2_SOCKET_PATH_STR);
|
||||
#define CFGOPT_PG2_USER "pg2-user"
|
||||
STRING_DECLARE(CFGOPT_PG2_USER_STR);
|
||||
#define CFGOPT_PG3_HOST "pg3-host"
|
||||
STRING_DECLARE(CFGOPT_PG3_HOST_STR);
|
||||
#define CFGOPT_PG3_HOST_CMD "pg3-host-cmd"
|
||||
@ -187,6 +191,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_PG3_PORT_STR);
|
||||
#define CFGOPT_PG3_SOCKET_PATH "pg3-socket-path"
|
||||
STRING_DECLARE(CFGOPT_PG3_SOCKET_PATH_STR);
|
||||
#define CFGOPT_PG3_USER "pg3-user"
|
||||
STRING_DECLARE(CFGOPT_PG3_USER_STR);
|
||||
#define CFGOPT_PG4_HOST "pg4-host"
|
||||
STRING_DECLARE(CFGOPT_PG4_HOST_STR);
|
||||
#define CFGOPT_PG4_HOST_CMD "pg4-host-cmd"
|
||||
@ -207,6 +213,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_PG4_PORT_STR);
|
||||
#define CFGOPT_PG4_SOCKET_PATH "pg4-socket-path"
|
||||
STRING_DECLARE(CFGOPT_PG4_SOCKET_PATH_STR);
|
||||
#define CFGOPT_PG4_USER "pg4-user"
|
||||
STRING_DECLARE(CFGOPT_PG4_USER_STR);
|
||||
#define CFGOPT_PG5_HOST "pg5-host"
|
||||
STRING_DECLARE(CFGOPT_PG5_HOST_STR);
|
||||
#define CFGOPT_PG5_HOST_CMD "pg5-host-cmd"
|
||||
@ -227,6 +235,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_PG5_PORT_STR);
|
||||
#define CFGOPT_PG5_SOCKET_PATH "pg5-socket-path"
|
||||
STRING_DECLARE(CFGOPT_PG5_SOCKET_PATH_STR);
|
||||
#define CFGOPT_PG5_USER "pg5-user"
|
||||
STRING_DECLARE(CFGOPT_PG5_USER_STR);
|
||||
#define CFGOPT_PG6_HOST "pg6-host"
|
||||
STRING_DECLARE(CFGOPT_PG6_HOST_STR);
|
||||
#define CFGOPT_PG6_HOST_CMD "pg6-host-cmd"
|
||||
@ -247,6 +257,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_PG6_PORT_STR);
|
||||
#define CFGOPT_PG6_SOCKET_PATH "pg6-socket-path"
|
||||
STRING_DECLARE(CFGOPT_PG6_SOCKET_PATH_STR);
|
||||
#define CFGOPT_PG6_USER "pg6-user"
|
||||
STRING_DECLARE(CFGOPT_PG6_USER_STR);
|
||||
#define CFGOPT_PG7_HOST "pg7-host"
|
||||
STRING_DECLARE(CFGOPT_PG7_HOST_STR);
|
||||
#define CFGOPT_PG7_HOST_CMD "pg7-host-cmd"
|
||||
@ -267,6 +279,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_PG7_PORT_STR);
|
||||
#define CFGOPT_PG7_SOCKET_PATH "pg7-socket-path"
|
||||
STRING_DECLARE(CFGOPT_PG7_SOCKET_PATH_STR);
|
||||
#define CFGOPT_PG7_USER "pg7-user"
|
||||
STRING_DECLARE(CFGOPT_PG7_USER_STR);
|
||||
#define CFGOPT_PG8_HOST "pg8-host"
|
||||
STRING_DECLARE(CFGOPT_PG8_HOST_STR);
|
||||
#define CFGOPT_PG8_HOST_CMD "pg8-host-cmd"
|
||||
@ -287,6 +301,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_PG8_PORT_STR);
|
||||
#define CFGOPT_PG8_SOCKET_PATH "pg8-socket-path"
|
||||
STRING_DECLARE(CFGOPT_PG8_SOCKET_PATH_STR);
|
||||
#define CFGOPT_PG8_USER "pg8-user"
|
||||
STRING_DECLARE(CFGOPT_PG8_USER_STR);
|
||||
#define CFGOPT_PROCESS "process"
|
||||
STRING_DECLARE(CFGOPT_PROCESS_STR);
|
||||
#define CFGOPT_PROCESS_MAX "process-max"
|
||||
@ -380,7 +396,7 @@ Option constants
|
||||
#define CFGOPT_TYPE "type"
|
||||
STRING_DECLARE(CFGOPT_TYPE_STR);
|
||||
|
||||
#define CFG_OPTION_TOTAL 163
|
||||
#define CFG_OPTION_TOTAL 171
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Command enum
|
||||
@ -531,6 +547,14 @@ typedef enum
|
||||
cfgOptPgSocketPath6,
|
||||
cfgOptPgSocketPath7,
|
||||
cfgOptPgSocketPath8,
|
||||
cfgOptPgUser,
|
||||
cfgOptPgUser2,
|
||||
cfgOptPgUser3,
|
||||
cfgOptPgUser4,
|
||||
cfgOptPgUser5,
|
||||
cfgOptPgUser6,
|
||||
cfgOptPgUser7,
|
||||
cfgOptPgUser8,
|
||||
cfgOptProcess,
|
||||
cfgOptProcessMax,
|
||||
cfgOptProtocolTimeout,
|
||||
|
@ -2418,6 +2418,44 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
|
||||
)
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
CFGDEFDATA_OPTION
|
||||
(
|
||||
CFGDEFDATA_OPTION_NAME("pg-user")
|
||||
CFGDEFDATA_OPTION_REQUIRED(false)
|
||||
CFGDEFDATA_OPTION_SECTION(cfgDefSectionStanza)
|
||||
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
|
||||
CFGDEFDATA_OPTION_INTERNAL(false)
|
||||
|
||||
CFGDEFDATA_OPTION_INDEX_TOTAL(8)
|
||||
CFGDEFDATA_OPTION_SECURE(false)
|
||||
|
||||
CFGDEFDATA_OPTION_HELP_SECTION("stanza")
|
||||
CFGDEFDATA_OPTION_HELP_SUMMARY("PostgreSQL database user.")
|
||||
CFGDEFDATA_OPTION_HELP_DESCRIPTION
|
||||
(
|
||||
"The database user name used when connecting to PostgreSQL. If not specified pgBackRest will connect with the local OS "
|
||||
"user or PGUSER."
|
||||
)
|
||||
|
||||
CFGDEFDATA_OPTION_COMMAND_LIST
|
||||
(
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdRemote)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaCreate)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaDelete)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaUpgrade)
|
||||
)
|
||||
|
||||
CFGDEFDATA_OPTION_OPTIONAL_LIST
|
||||
(
|
||||
CFGDEFDATA_OPTION_OPTIONAL_DEPEND(cfgDefOptPgPath)
|
||||
CFGDEFDATA_OPTION_OPTIONAL_PREFIX("pg")
|
||||
)
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
CFGDEFDATA_OPTION
|
||||
(
|
||||
|
@ -99,6 +99,7 @@ typedef enum
|
||||
cfgDefOptPgPath,
|
||||
cfgDefOptPgPort,
|
||||
cfgDefOptPgSocketPath,
|
||||
cfgDefOptPgUser,
|
||||
cfgDefOptProcess,
|
||||
cfgDefOptProcessMax,
|
||||
cfgDefOptProtocolTimeout,
|
||||
|
@ -1575,6 +1575,81 @@ static const struct option optionList[] =
|
||||
.val = PARSE_OPTION_FLAG | PARSE_DEPRECATE_FLAG | (cfgOptPgSocketPath + 7),
|
||||
},
|
||||
|
||||
// pg-user option
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
.name = CFGOPT_PG1_USER,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | cfgOptPgUser,
|
||||
},
|
||||
{
|
||||
.name = "reset-" CFGOPT_PG1_USER,
|
||||
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | cfgOptPgUser,
|
||||
},
|
||||
{
|
||||
.name = CFGOPT_PG2_USER,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | (cfgOptPgUser + 1),
|
||||
},
|
||||
{
|
||||
.name = "reset-" CFGOPT_PG2_USER,
|
||||
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | (cfgOptPgUser + 1),
|
||||
},
|
||||
{
|
||||
.name = CFGOPT_PG3_USER,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | (cfgOptPgUser + 2),
|
||||
},
|
||||
{
|
||||
.name = "reset-" CFGOPT_PG3_USER,
|
||||
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | (cfgOptPgUser + 2),
|
||||
},
|
||||
{
|
||||
.name = CFGOPT_PG4_USER,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | (cfgOptPgUser + 3),
|
||||
},
|
||||
{
|
||||
.name = "reset-" CFGOPT_PG4_USER,
|
||||
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | (cfgOptPgUser + 3),
|
||||
},
|
||||
{
|
||||
.name = CFGOPT_PG5_USER,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | (cfgOptPgUser + 4),
|
||||
},
|
||||
{
|
||||
.name = "reset-" CFGOPT_PG5_USER,
|
||||
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | (cfgOptPgUser + 4),
|
||||
},
|
||||
{
|
||||
.name = CFGOPT_PG6_USER,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | (cfgOptPgUser + 5),
|
||||
},
|
||||
{
|
||||
.name = "reset-" CFGOPT_PG6_USER,
|
||||
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | (cfgOptPgUser + 5),
|
||||
},
|
||||
{
|
||||
.name = CFGOPT_PG7_USER,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | (cfgOptPgUser + 6),
|
||||
},
|
||||
{
|
||||
.name = "reset-" CFGOPT_PG7_USER,
|
||||
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | (cfgOptPgUser + 6),
|
||||
},
|
||||
{
|
||||
.name = CFGOPT_PG8_USER,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | (cfgOptPgUser + 7),
|
||||
},
|
||||
{
|
||||
.name = "reset-" CFGOPT_PG8_USER,
|
||||
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | (cfgOptPgUser + 7),
|
||||
},
|
||||
|
||||
// process option
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
@ -2354,6 +2429,14 @@ static const ConfigOption optionResolveOrder[] =
|
||||
cfgOptPgSocketPath + 5,
|
||||
cfgOptPgSocketPath + 6,
|
||||
cfgOptPgSocketPath + 7,
|
||||
cfgOptPgUser,
|
||||
cfgOptPgUser + 1,
|
||||
cfgOptPgUser + 2,
|
||||
cfgOptPgUser + 3,
|
||||
cfgOptPgUser + 4,
|
||||
cfgOptPgUser + 5,
|
||||
cfgOptPgUser + 6,
|
||||
cfgOptPgUser + 7,
|
||||
cfgOptProcess,
|
||||
cfgOptProcessMax,
|
||||
cfgOptProtocolTimeout,
|
||||
|
@ -32,8 +32,8 @@ dbGetId(unsigned int pgId)
|
||||
{
|
||||
result = dbNew(
|
||||
pgClientNew(
|
||||
cfgOptionStr(cfgOptPgSocketPath + pgId - 1), cfgOptionUInt(cfgOptPgPort + pgId - 1), PG_DB_POSTGRES_STR, NULL,
|
||||
(TimeMSec)(cfgOptionDbl(cfgOptDbTimeout) * MSEC_PER_SEC)),
|
||||
cfgOptionStr(cfgOptPgSocketPath + pgId - 1), cfgOptionUInt(cfgOptPgPort + pgId - 1), PG_DB_POSTGRES_STR,
|
||||
cfgOptionStr(cfgOptPgUser + pgId - 1), (TimeMSec)(cfgOptionDbl(cfgOptDbTimeout) * MSEC_PER_SEC)),
|
||||
NULL, applicationName);
|
||||
}
|
||||
else
|
||||
|
@ -64,7 +64,7 @@ dbProtocol(const String *command, const VariantList *paramList, ProtocolServer *
|
||||
{
|
||||
// Only a single db is passed to the remote
|
||||
PgClient *pgClient = pgClientNew(
|
||||
cfgOptionStr(cfgOptPgSocketPath), cfgOptionUInt(cfgOptPgPort), PG_DB_POSTGRES_STR, NULL,
|
||||
cfgOptionStr(cfgOptPgSocketPath), cfgOptionUInt(cfgOptPgPort), PG_DB_POSTGRES_STR, cfgOptionStr(cfgOptPgUser),
|
||||
(TimeMSec)(cfgOptionDbl(cfgOptDbTimeout) * MSEC_PER_SEC));
|
||||
pgClientOpen(pgClient);
|
||||
|
||||
|
@ -448,11 +448,12 @@ testRun(void)
|
||||
strLstAddZ(argList, "--stanza=test1");
|
||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||
strLstAddZ(argList, "--pg1-path=/path/to/pg");
|
||||
harnessCfgLoad(cfgCmdBackup, argList);
|
||||
strLstAddZ(argList, "--pg1-user=bob");
|
||||
harnessCfgLoad(cfgCmdBackup, argList);
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
{.function = HRNPQ_CONNECTDB, .param = "[\"dbname='postgres' port=5432\"]"},
|
||||
{.function = HRNPQ_CONNECTDB, .param = "[\"dbname='postgres' port=5432 user='bob'\"]"},
|
||||
{.function = HRNPQ_STATUS, .resultInt = CONNECTION_BAD},
|
||||
{.function = HRNPQ_ERRORMESSAGE, .resultZ = "error"},
|
||||
{.function = HRNPQ_FINISH},
|
||||
@ -461,13 +462,14 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(dbGet(true, true, false), DbConnectError, "unable to find primary cluster - cannot proceed");
|
||||
harnessLogResult(
|
||||
"P00 WARN: unable to check pg-1: [DbConnectError] unable to connect to 'dbname='postgres' port=5432': error");
|
||||
"P00 WARN: unable to check pg-1: [DbConnectError] unable to connect to 'dbname='postgres' port=5432 user='bob'':"
|
||||
" error");
|
||||
|
||||
// Only cluster is a standby
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN(1, "dbname='postgres' port=5432"),
|
||||
HRNPQ_MACRO_OPEN(1, "dbname='postgres' port=5432 user='bob'"),
|
||||
HRNPQ_MACRO_SET_SEARCH_PATH(1),
|
||||
HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_94, "/pgdata", NULL, NULL),
|
||||
HRNPQ_MACRO_SET_APPLICATION_NAME(1),
|
||||
@ -483,7 +485,7 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN(1, "dbname='postgres' port=5432"),
|
||||
HRNPQ_MACRO_OPEN(1, "dbname='postgres' port=5432 user='bob'"),
|
||||
HRNPQ_MACRO_SET_SEARCH_PATH(1),
|
||||
HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_94, "/pgdata", NULL, NULL),
|
||||
HRNPQ_MACRO_SET_APPLICATION_NAME(1),
|
||||
@ -498,7 +500,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_LE_91(1, "dbname='postgres' port=5432", PG_VERSION_84, "/pgdata", NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_LE_91(1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_84, "/pgdata", NULL, NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user