mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-20 04:59:25 +02:00
Improve config file handling in doc/test config load.
Since 1141dc20 it has been possible to request that cfgParse() skip loading the config file. Use this logic to replace the code used to ignore config files in doc/test config load.
This commit is contained in:
parent
ec3e387bb7
commit
32a6dd6c3d
@ -47,9 +47,6 @@ cfgLoadUpdateOption(void)
|
||||
char currentWorkDir[1024];
|
||||
THROW_ON_SYS_ERROR(getcwd(currentWorkDir, sizeof(currentWorkDir)) == NULL, FormatError, "unable to get cwd");
|
||||
|
||||
// Invalidate config option so it does not show up in option list
|
||||
cfgOptionInvalidate(cfgOptConfig);
|
||||
|
||||
// If repo-path is relative then make it absolute
|
||||
const String *const repoPath = cfgOptionStr(cfgOptRepoPath);
|
||||
|
||||
@ -76,18 +73,15 @@ cfgLoad(unsigned int argListSize, const char *argList[])
|
||||
for (unsigned int argListIdx = 0; argListIdx < argListSize; argListIdx++)
|
||||
strLstAddZ(argListNew, argList[argListIdx]);
|
||||
|
||||
// Explicitly set --no-config so a stray config file will not be loaded
|
||||
strLstAddZ(argListNew, "--no-" CFGOPT_CONFIG);
|
||||
|
||||
// Parse config from command line
|
||||
TRY_BEGIN()
|
||||
{
|
||||
cfgParseP(storagePosixNewP(FSLASH_STR), strLstSize(argListNew), strLstPtr(argListNew));
|
||||
cfgParseP(storagePosixNewP(FSLASH_STR), strLstSize(argListNew), strLstPtr(argListNew), .noConfigLoad = true);
|
||||
}
|
||||
CATCH(CommandRequiredError)
|
||||
{
|
||||
strLstAddZ(argListNew, CFGCMD_BUILD);
|
||||
cfgParseP(storagePosixNewP(FSLASH_STR), strLstSize(argListNew), strLstPtr(argListNew));
|
||||
cfgParseP(storagePosixNewP(FSLASH_STR), strLstSize(argListNew), strLstPtr(argListNew), .noConfigLoad = true);
|
||||
}
|
||||
TRY_END();
|
||||
|
||||
|
@ -47,9 +47,6 @@ cfgLoadUpdateOption(void)
|
||||
char currentWorkDir[1024];
|
||||
THROW_ON_SYS_ERROR(getcwd(currentWorkDir, sizeof(currentWorkDir)) == NULL, FormatError, "unable to get cwd");
|
||||
|
||||
// Invalidate config option so it does not show up in option list
|
||||
cfgOptionInvalidate(cfgOptConfig);
|
||||
|
||||
// If repo-path is relative then make it absolute
|
||||
const String *const repoPath = cfgOptionStr(cfgOptRepoPath);
|
||||
|
||||
@ -82,18 +79,15 @@ cfgLoad(unsigned int argListSize, const char *argList[])
|
||||
for (unsigned int argListIdx = 0; argListIdx < argListSize; argListIdx++)
|
||||
strLstAddZ(argListNew, argList[argListIdx]);
|
||||
|
||||
// Explicitly set --no-config so a stray config file will not be loaded
|
||||
strLstAddZ(argListNew, "--no-" CFGOPT_CONFIG);
|
||||
|
||||
// Parse config from command line
|
||||
TRY_BEGIN()
|
||||
{
|
||||
cfgParseP(storagePosixNewP(FSLASH_STR), strLstSize(argListNew), strLstPtr(argListNew));
|
||||
cfgParseP(storagePosixNewP(FSLASH_STR), strLstSize(argListNew), strLstPtr(argListNew), .noConfigLoad = true);
|
||||
}
|
||||
CATCH(CommandRequiredError)
|
||||
{
|
||||
strLstAddZ(argListNew, CFGCMD_TEST);
|
||||
cfgParseP(storagePosixNewP(FSLASH_STR), strLstSize(argListNew), strLstPtr(argListNew));
|
||||
cfgParseP(storagePosixNewP(FSLASH_STR), strLstSize(argListNew), strLstPtr(argListNew), .noConfigLoad = true);
|
||||
}
|
||||
TRY_END();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user