mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-04-15 11:36:40 +02:00
Add StringId as an option type.
Rather the converting String to StringIds at runtime, store defaults in StringId format in parse.auto.c and convert user input to StringId during parsing.
This commit is contained in:
parent
b13844086d
commit
7f6c513be9
@ -24,6 +24,9 @@
|
|||||||
<commit subject="Use cfgOptionStrId() instead of cfgOptionStr() where appropriate.">
|
<commit subject="Use cfgOptionStrId() instead of cfgOptionStr() where appropriate.">
|
||||||
<github-pull-request id="1554"/>
|
<github-pull-request id="1554"/>
|
||||||
</commit>
|
</commit>
|
||||||
|
<commit subject="Add StringId as an option type.">
|
||||||
|
<github-pull-request id="1555"/>
|
||||||
|
</commit>
|
||||||
|
|
||||||
<release-item-contributor-list>
|
<release-item-contributor-list>
|
||||||
<release-item-contributor id="david.steele"/>
|
<release-item-contributor id="david.steele"/>
|
||||||
|
@ -300,7 +300,7 @@ option:
|
|||||||
main: {}
|
main: {}
|
||||||
|
|
||||||
output:
|
output:
|
||||||
type: string
|
type: string-id
|
||||||
default: text
|
default: text
|
||||||
command:
|
command:
|
||||||
info: {}
|
info: {}
|
||||||
@ -372,7 +372,7 @@ option:
|
|||||||
main: {}
|
main: {}
|
||||||
|
|
||||||
target-action:
|
target-action:
|
||||||
type: string
|
type: string-id
|
||||||
default: pause
|
default: pause
|
||||||
command:
|
command:
|
||||||
restore: {}
|
restore: {}
|
||||||
@ -423,6 +423,7 @@ option:
|
|||||||
main: {}
|
main: {}
|
||||||
|
|
||||||
type:
|
type:
|
||||||
|
type: string-id
|
||||||
command:
|
command:
|
||||||
backup:
|
backup:
|
||||||
allow-list:
|
allow-list:
|
||||||
@ -444,7 +445,6 @@ option:
|
|||||||
default: default
|
default: default
|
||||||
command-role:
|
command-role:
|
||||||
main: {}
|
main: {}
|
||||||
type: string
|
|
||||||
|
|
||||||
# Command-line only local/remote options
|
# Command-line only local/remote options
|
||||||
#---------------------------------------------------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -479,7 +479,7 @@ option:
|
|||||||
remote: {}
|
remote: {}
|
||||||
|
|
||||||
remote-type:
|
remote-type:
|
||||||
type: string
|
type: string-id
|
||||||
internal: true
|
internal: true
|
||||||
required: false
|
required: false
|
||||||
allow-list:
|
allow-list:
|
||||||
@ -552,7 +552,7 @@ option:
|
|||||||
main: {}
|
main: {}
|
||||||
|
|
||||||
sort:
|
sort:
|
||||||
type: string
|
type: string-id
|
||||||
default: asc
|
default: asc
|
||||||
allow-list:
|
allow-list:
|
||||||
- none
|
- none
|
||||||
@ -686,7 +686,7 @@ option:
|
|||||||
|
|
||||||
compress-type:
|
compress-type:
|
||||||
section: global
|
section: global
|
||||||
type: string
|
type: string-id
|
||||||
default: gz
|
default: gz
|
||||||
allow-list:
|
allow-list:
|
||||||
- none
|
- none
|
||||||
@ -959,7 +959,7 @@ option:
|
|||||||
#---------------------------------------------------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------------------------------------------------
|
||||||
log-level-console:
|
log-level-console:
|
||||||
section: global
|
section: global
|
||||||
type: string
|
type: string-id
|
||||||
default: warn
|
default: warn
|
||||||
allow-list:
|
allow-list:
|
||||||
- off
|
- off
|
||||||
@ -972,13 +972,13 @@ option:
|
|||||||
|
|
||||||
log-level-file:
|
log-level-file:
|
||||||
section: global
|
section: global
|
||||||
type: string
|
type: string-id
|
||||||
default: info
|
default: info
|
||||||
allow-list: log-level-console
|
allow-list: log-level-console
|
||||||
|
|
||||||
log-level-stderr:
|
log-level-stderr:
|
||||||
section: global
|
section: global
|
||||||
type: string
|
type: string-id
|
||||||
default: warn
|
default: warn
|
||||||
allow-list: log-level-console
|
allow-list: log-level-console
|
||||||
|
|
||||||
@ -1181,7 +1181,7 @@ option:
|
|||||||
#---------------------------------------------------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------------------------------------------------
|
||||||
archive-mode:
|
archive-mode:
|
||||||
section: global
|
section: global
|
||||||
type: string
|
type: string-id
|
||||||
default: preserve
|
default: preserve
|
||||||
allow-list:
|
allow-list:
|
||||||
- off
|
- off
|
||||||
@ -1420,7 +1420,7 @@ option:
|
|||||||
internal: true
|
internal: true
|
||||||
section: global
|
section: global
|
||||||
group: pg
|
group: pg
|
||||||
type: string
|
type: string-id
|
||||||
default: ssh
|
default: ssh
|
||||||
allow-list:
|
allow-list:
|
||||||
- ssh
|
- ssh
|
||||||
@ -1602,7 +1602,7 @@ option:
|
|||||||
repo-type:
|
repo-type:
|
||||||
section: global
|
section: global
|
||||||
group: repo
|
group: repo
|
||||||
type: string
|
type: string-id
|
||||||
default: posix
|
default: posix
|
||||||
allow-list:
|
allow-list:
|
||||||
- azure
|
- azure
|
||||||
@ -1714,6 +1714,7 @@ option:
|
|||||||
|
|
||||||
repo-azure-key-type:
|
repo-azure-key-type:
|
||||||
inherit: repo-azure-container
|
inherit: repo-azure-container
|
||||||
|
type: string-id
|
||||||
default: shared
|
default: shared
|
||||||
allow-list:
|
allow-list:
|
||||||
- shared
|
- shared
|
||||||
@ -1722,7 +1723,7 @@ option:
|
|||||||
repo-azure-uri-style:
|
repo-azure-uri-style:
|
||||||
section: global
|
section: global
|
||||||
group: repo
|
group: repo
|
||||||
type: string
|
type: string-id
|
||||||
default: host
|
default: host
|
||||||
allow-list:
|
allow-list:
|
||||||
- host
|
- host
|
||||||
@ -1745,7 +1746,7 @@ option:
|
|||||||
|
|
||||||
repo-cipher-type:
|
repo-cipher-type:
|
||||||
section: global
|
section: global
|
||||||
type: string
|
type: string-id
|
||||||
group: repo
|
group: repo
|
||||||
default: none
|
default: none
|
||||||
allow-list:
|
allow-list:
|
||||||
@ -1785,7 +1786,7 @@ option:
|
|||||||
|
|
||||||
repo-gcs-key-type:
|
repo-gcs-key-type:
|
||||||
section: global
|
section: global
|
||||||
type: string
|
type: string-id
|
||||||
group: repo
|
group: repo
|
||||||
default: service
|
default: service
|
||||||
allow-list:
|
allow-list:
|
||||||
@ -1814,7 +1815,7 @@ option:
|
|||||||
internal: true
|
internal: true
|
||||||
section: global
|
section: global
|
||||||
group: repo
|
group: repo
|
||||||
type: string
|
type: string-id
|
||||||
default: ssh
|
default: ssh
|
||||||
allow-list:
|
allow-list:
|
||||||
- ssh
|
- ssh
|
||||||
@ -1984,7 +1985,7 @@ option:
|
|||||||
|
|
||||||
repo-retention-archive-type:
|
repo-retention-archive-type:
|
||||||
section: global
|
section: global
|
||||||
type: string
|
type: string-id
|
||||||
group: repo
|
group: repo
|
||||||
default: full
|
default: full
|
||||||
allow-list:
|
allow-list:
|
||||||
@ -2016,7 +2017,7 @@ option:
|
|||||||
repo-retention-full-type:
|
repo-retention-full-type:
|
||||||
section: global
|
section: global
|
||||||
group: repo
|
group: repo
|
||||||
type: string
|
type: string-id
|
||||||
default: count
|
default: count
|
||||||
allow-list:
|
allow-list:
|
||||||
- count
|
- count
|
||||||
@ -2088,6 +2089,7 @@ option:
|
|||||||
|
|
||||||
repo-s3-key-type:
|
repo-s3-key-type:
|
||||||
inherit: repo-s3-bucket
|
inherit: repo-s3-bucket
|
||||||
|
type: string-id
|
||||||
default: shared
|
default: shared
|
||||||
allow-list:
|
allow-list:
|
||||||
- shared
|
- shared
|
||||||
@ -2115,7 +2117,7 @@ option:
|
|||||||
repo-s3-uri-style:
|
repo-s3-uri-style:
|
||||||
section: global
|
section: global
|
||||||
group: repo
|
group: repo
|
||||||
type: string
|
type: string-id
|
||||||
default: host
|
default: host
|
||||||
allow-list:
|
allow-list:
|
||||||
- host
|
- host
|
||||||
|
@ -43,7 +43,7 @@ Option type constants
|
|||||||
STRING_DECLARE(OPT_TYPE_SIZE_STR);
|
STRING_DECLARE(OPT_TYPE_SIZE_STR);
|
||||||
#define OPT_TYPE_STRING "string"
|
#define OPT_TYPE_STRING "string"
|
||||||
STRING_DECLARE(OPT_TYPE_STRING_STR);
|
STRING_DECLARE(OPT_TYPE_STRING_STR);
|
||||||
#define OPT_TYPE_STRING_ID "stringId"
|
#define OPT_TYPE_STRING_ID "string-id"
|
||||||
STRING_DECLARE(OPT_TYPE_STRING_ID_STR);
|
STRING_DECLARE(OPT_TYPE_STRING_ID_STR);
|
||||||
#define OPT_TYPE_TIME "time"
|
#define OPT_TYPE_TIME "time"
|
||||||
STRING_DECLARE(OPT_TYPE_TIME_STR);
|
STRING_DECLARE(OPT_TYPE_TIME_STR);
|
||||||
|
@ -152,7 +152,7 @@ bldCfgRenderConfigAutoH(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
{
|
{
|
||||||
const BldCfgOption *const opt = lstGet(bldCfg.optList, optIdx);
|
const BldCfgOption *const opt = lstGet(bldCfg.optList, optIdx);
|
||||||
|
|
||||||
if (strEqZ(opt->type, CFGDEF_TYPE_STRING))
|
if (strEq(opt->type, OPT_TYPE_STRING_ID_STR))
|
||||||
{
|
{
|
||||||
StringList *const allowList = strLstNew();
|
StringList *const allowList = strLstNew();
|
||||||
|
|
||||||
@ -175,28 +175,27 @@ bldCfgRenderConfigAutoH(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
|
|
||||||
strLstSort(allowList, sortOrderAsc);
|
strLstSort(allowList, sortOrderAsc);
|
||||||
|
|
||||||
if (!strLstEmpty(allowList))
|
ASSERT(!strLstEmpty(allowList));
|
||||||
|
|
||||||
|
if (lf)
|
||||||
|
strCatChr(config, '\n');
|
||||||
|
|
||||||
|
for (unsigned int allowListIdx = 0; allowListIdx < strLstSize(allowList); allowListIdx++)
|
||||||
{
|
{
|
||||||
if (lf)
|
const String *const allowListItem = strLstGet(allowList, allowListIdx);
|
||||||
strCatChr(config, '\n');
|
const String *const constPrefix = strUpper(
|
||||||
|
strReplaceChr(strNewFmt("CFGOPTVAL_%s_%s", strZ(opt->name), strZ(allowListItem)), '-', '_'));
|
||||||
|
|
||||||
for (unsigned int allowListIdx = 0; allowListIdx < strLstSize(allowList); allowListIdx++)
|
// Render StringId
|
||||||
{
|
strCatFmt(config, "%s\n", strZ(bldDefineRender(constPrefix, bldStrId(strZ(allowListItem)))));
|
||||||
const String *const allowListItem = strLstGet(allowList, allowListIdx);
|
|
||||||
const String *const constPrefix = strUpper(
|
|
||||||
strReplaceChr(strNewFmt("CFGOPTVAL_%s_%s", strZ(opt->name), strZ(allowListItem)), '-', '_'));
|
|
||||||
|
|
||||||
// Render StringId
|
// Render Z
|
||||||
strCatFmt(config, "%s\n", strZ(bldDefineRender(constPrefix, bldStrId(strZ(allowListItem)))));
|
strCatFmt(
|
||||||
|
config, "%s\n",
|
||||||
// Render Z
|
strZ(bldDefineRender(strNewFmt("%s_Z", strZ(constPrefix)), strNewFmt("\"%s\"", strZ(allowListItem)))));
|
||||||
strCatFmt(
|
|
||||||
config, "%s\n",
|
|
||||||
strZ(bldDefineRender(strNewFmt("%s_Z", strZ(constPrefix)), strNewFmt("\"%s\"", strZ(allowListItem)))));
|
|
||||||
}
|
|
||||||
|
|
||||||
lf = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lf = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +490,7 @@ bldCfgRenderDefault(
|
|||||||
" PARSE_RULE_OPTIONAL_DEFAULT\n"
|
" PARSE_RULE_OPTIONAL_DEFAULT\n"
|
||||||
" (\n");
|
" (\n");
|
||||||
|
|
||||||
if (!strEq(optType, OPT_TYPE_STRING_STR) && !strEq(optType, OPT_TYPE_PATH_STR) && !strEq(optType, OPT_TYPE_STRING_ID_STR))
|
if (!strEq(optType, OPT_TYPE_STRING_STR) && !strEq(optType, OPT_TYPE_PATH_STR))
|
||||||
strCatFmt(result, " %s,\n", strZ(bldCfgRenderScalar(defaultValue, optType)));
|
strCatFmt(result, " %s,\n", strZ(bldCfgRenderScalar(defaultValue, optType)));
|
||||||
|
|
||||||
if (!strEq(optType, OPT_TYPE_BOOLEAN_STR))
|
if (!strEq(optType, OPT_TYPE_BOOLEAN_STR))
|
||||||
@ -745,16 +744,6 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if the option has an allow list. This will decide whether it is treated as a String or StringId. This should be
|
|
||||||
// replaced with a StringId type.
|
|
||||||
bool allowList = opt->allowList != NULL;
|
|
||||||
|
|
||||||
for (unsigned int optCmdIdx = 0; optCmdIdx < lstSize(opt->cmdList); optCmdIdx++)
|
|
||||||
{
|
|
||||||
if (((BldCfgOptionCommand *)lstGet(opt->cmdList, optCmdIdx))->allowList != NULL)
|
|
||||||
allowList = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build default optional rules
|
// Build default optional rules
|
||||||
KeyValue *const optionalDefaultRule = kvNew();
|
KeyValue *const optionalDefaultRule = kvNew();
|
||||||
const Variant *const ruleDepend = VARSTRDEF("01-depend");
|
const Variant *const ruleDepend = VARSTRDEF("01-depend");
|
||||||
@ -787,11 +776,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
|
|
||||||
if (opt->allowList != NULL)
|
if (opt->allowList != NULL)
|
||||||
{
|
{
|
||||||
kvAdd(
|
kvAdd(optionalDefaultRule, ruleAllowList, VARSTR(bldCfgRenderAllowList(opt->allowList, opt->type)));
|
||||||
optionalDefaultRule, ruleAllowList,
|
|
||||||
VARSTR(
|
|
||||||
bldCfgRenderAllowList(
|
|
||||||
opt->allowList, strEq(opt->type, OPT_TYPE_STRING_STR) ? OPT_TYPE_STRING_ID_STR : opt->type)));
|
|
||||||
|
|
||||||
for (unsigned int allowIdx = 0; allowIdx < strLstSize(opt->allowList); allowIdx++)
|
for (unsigned int allowIdx = 0; allowIdx < strLstSize(opt->allowList); allowIdx++)
|
||||||
strLstAddIfMissing(ruleDataList, strLstGet(opt->allowList, allowIdx));
|
strLstAddIfMissing(ruleDataList, strLstGet(opt->allowList, allowIdx));
|
||||||
@ -799,12 +784,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
|
|
||||||
if (opt->defaultValue != NULL)
|
if (opt->defaultValue != NULL)
|
||||||
{
|
{
|
||||||
kvAdd(
|
kvAdd(optionalDefaultRule, ruleDefault, VARSTR(bldCfgRenderDefault(opt->defaultValue, opt->defaultLiteral, opt->type)));
|
||||||
optionalDefaultRule, ruleDefault,
|
|
||||||
VARSTR(
|
|
||||||
bldCfgRenderDefault(
|
|
||||||
opt->defaultValue, opt->defaultLiteral,
|
|
||||||
strEq(opt->type, OPT_TYPE_STRING_STR) && allowList ? OPT_TYPE_STRING_ID_STR : opt->type)));
|
|
||||||
|
|
||||||
if (!strEq(opt->type, OPT_TYPE_BOOLEAN_STR))
|
if (!strEq(opt->type, OPT_TYPE_BOOLEAN_STR))
|
||||||
{
|
{
|
||||||
@ -837,11 +817,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
// Allow lists
|
// Allow lists
|
||||||
if (optCmd->allowList != NULL)
|
if (optCmd->allowList != NULL)
|
||||||
{
|
{
|
||||||
kvAdd(
|
kvAdd(optionalCmdRuleType, ruleAllowList, VARSTR(bldCfgRenderAllowList(optCmd->allowList, opt->type)));
|
||||||
optionalCmdRuleType, ruleAllowList,
|
|
||||||
VARSTR(
|
|
||||||
bldCfgRenderAllowList(
|
|
||||||
optCmd->allowList, strEq(opt->type, OPT_TYPE_STRING_STR) ? OPT_TYPE_STRING_ID_STR : opt->type)));
|
|
||||||
|
|
||||||
for (unsigned int allowIdx = 0; allowIdx < strLstSize(optCmd->allowList); allowIdx++)
|
for (unsigned int allowIdx = 0; allowIdx < strLstSize(optCmd->allowList); allowIdx++)
|
||||||
strLstAddIfMissing(ruleDataList, strLstGet(optCmd->allowList, allowIdx));
|
strLstAddIfMissing(ruleDataList, strLstGet(optCmd->allowList, allowIdx));
|
||||||
@ -852,10 +828,7 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
{
|
{
|
||||||
kvAdd(
|
kvAdd(
|
||||||
optionalCmdRuleType, ruleDefault,
|
optionalCmdRuleType, ruleDefault,
|
||||||
VARSTR(
|
VARSTR(bldCfgRenderDefault(optCmd->defaultValue, opt->defaultLiteral, opt->type)));
|
||||||
bldCfgRenderDefault(
|
|
||||||
optCmd->defaultValue, opt->defaultLiteral,
|
|
||||||
strEq(opt->type, OPT_TYPE_STRING_STR) && allowList ? OPT_TYPE_STRING_ID_STR : opt->type)));
|
|
||||||
|
|
||||||
if (!strEq(opt->type, OPT_TYPE_BOOLEAN_STR))
|
if (!strEq(opt->type, OPT_TYPE_BOOLEAN_STR))
|
||||||
{
|
{
|
||||||
@ -1003,10 +976,11 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
|
|
||||||
if (strEq(opt->type, OPT_TYPE_STRING_STR) || strEq(opt->type, OPT_TYPE_PATH_STR))
|
if (strEq(opt->type, OPT_TYPE_STRING_STR) || strEq(opt->type, OPT_TYPE_PATH_STR))
|
||||||
{
|
{
|
||||||
if (allowList)
|
ruleAddList = ruleStrList;
|
||||||
ruleAddList = ruleStrIdList;
|
}
|
||||||
else
|
else if (strEq(opt->type, OPT_TYPE_STRING_ID_STR))
|
||||||
ruleAddList = ruleStrList;
|
{
|
||||||
|
ruleAddList = ruleStrIdList;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1017,19 +991,20 @@ bldCfgRenderParseAutoC(const Storage *const storageRepo, const BldCfg bldCfg)
|
|||||||
for (unsigned int ruleDataIdx = 0; ruleDataIdx < strLstSize(ruleDataList); ruleDataIdx++)
|
for (unsigned int ruleDataIdx = 0; ruleDataIdx < strLstSize(ruleDataList); ruleDataIdx++)
|
||||||
{
|
{
|
||||||
if (ruleInt)
|
if (ruleInt)
|
||||||
|
{
|
||||||
strLstAddIfMissing(ruleAddList, strNewFmt("%20s", strZ(strLstGet(ruleDataList, ruleDataIdx))));
|
strLstAddIfMissing(ruleAddList, strNewFmt("%20s", strZ(strLstGet(ruleDataList, ruleDataIdx))));
|
||||||
|
}
|
||||||
|
else if (strEq(opt->type, OPT_TYPE_STRING_ID_STR))
|
||||||
|
{
|
||||||
|
strLstAddIfMissing(ruleAddList, strLstGet(ruleDataList, ruleDataIdx));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (allowList)
|
strLstAddIfMissing(
|
||||||
strLstAddIfMissing(ruleAddList, strLstGet(ruleDataList, ruleDataIdx));
|
ruleAddList,
|
||||||
else
|
strNewFmt(
|
||||||
{
|
"%s%s%s", opt->defaultLiteral ? "" : "\"", strZ(strLstGet(ruleDataList, ruleDataIdx)),
|
||||||
strLstAddIfMissing(
|
opt->defaultLiteral ? "" : "\""));
|
||||||
ruleAddList,
|
|
||||||
strNewFmt(
|
|
||||||
"%s%s%s", opt->defaultLiteral ? "" : "\"", strZ(strLstGet(ruleDataList, ruleDataIdx)),
|
|
||||||
opt->defaultLiteral ? "" : "\""));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ backupBuildIncrPrior(const InfoBackup *infoBackup)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARN_FMT("no prior backup exists, %s backup has been changed to full", strZ(cfgOptionDisplay(cfgOptType)));
|
LOG_WARN_FMT("no prior backup exists, %s backup has been changed to full", strZ(cfgOptionDisplay(cfgOptType)));
|
||||||
cfgOptionSet(cfgOptType, cfgSourceParam, VARSTR(strIdToStr(backupTypeFull)));
|
cfgOptionSet(cfgOptType, cfgSourceParam, VARUINT64(backupTypeFull));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
@ -456,6 +456,10 @@ cfgOptionDisplayVar(const Variant *const value, const ConfigOptionType optionTyp
|
|||||||
{
|
{
|
||||||
FUNCTION_TEST_RETURN(strNewDbl((double)varInt64(value) / MSEC_PER_SEC));
|
FUNCTION_TEST_RETURN(strNewDbl((double)varInt64(value) / MSEC_PER_SEC));
|
||||||
}
|
}
|
||||||
|
else if (optionType == cfgOptTypeStringId)
|
||||||
|
{
|
||||||
|
FUNCTION_TEST_RETURN(strIdToStr(varUInt64(value)));
|
||||||
|
}
|
||||||
|
|
||||||
FUNCTION_TEST_RETURN(varStrForce(value));
|
FUNCTION_TEST_RETURN(varStrForce(value));
|
||||||
}
|
}
|
||||||
@ -773,6 +777,9 @@ cfgOptionIdxVar(const ConfigOption optionId, const unsigned int optionIdx)
|
|||||||
case cfgOptDataTypeList:
|
case cfgOptDataTypeList:
|
||||||
FUNCTION_TEST_RETURN(varNewVarLst(configLocal->option[optionId].index[optionIdx].value.list));
|
FUNCTION_TEST_RETURN(varNewVarLst(configLocal->option[optionId].index[optionIdx].value.list));
|
||||||
|
|
||||||
|
case cfgOptDataTypeStringId:
|
||||||
|
FUNCTION_TEST_RETURN(varNewUInt64(configLocal->option[optionId].index[optionIdx].value.stringId));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT(configLocal->option[optionId].dataType == cfgOptDataTypeString);
|
ASSERT(configLocal->option[optionId].dataType == cfgOptDataTypeString);
|
||||||
break;
|
break;
|
||||||
@ -924,10 +931,7 @@ cfgOptionIdxStrId(ConfigOption optionId, unsigned int optionIdx)
|
|||||||
FUNCTION_LOG_PARAM(UINT, optionIdx);
|
FUNCTION_LOG_PARAM(UINT, optionIdx);
|
||||||
FUNCTION_LOG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
// At some point the config parser will work with StringIds directly and strIdFromStr() will be removed, but for now it protects
|
FUNCTION_LOG_RETURN(STRING_ID, cfgOptionIdxInternal(optionId, optionIdx, cfgOptDataTypeStringId, false)->value.stringId);
|
||||||
// the callers from this logic and hopefully means no changes to the callers when the parser is updated.
|
|
||||||
FUNCTION_LOG_RETURN(
|
|
||||||
STRING_ID, strIdFromStr(cfgOptionIdxInternal(optionId, optionIdx, cfgOptDataTypeString, false)->value.string));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************************/
|
/**********************************************************************************************************************************/
|
||||||
@ -997,6 +1001,16 @@ cfgOptionIdxSet(ConfigOption optionId, unsigned int optionIdx, ConfigSource sour
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case cfgOptDataTypeStringId:
|
||||||
|
{
|
||||||
|
if (varType(value) == varTypeUInt64)
|
||||||
|
configLocal->option[optionId].index[optionIdx].value.stringId = varUInt64(value);
|
||||||
|
else
|
||||||
|
configLocal->option[optionId].index[optionIdx].value.stringId = strIdFromStr(varStr(value));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
THROW_FMT(AssertError, "set not available for option data type %u", configLocal->option[optionId].dataType);
|
THROW_FMT(AssertError, "set not available for option data type %u", configLocal->option[optionId].dataType);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ typedef union ConfigOptionValueType
|
|||||||
const KeyValue *keyValue; // KeyValue
|
const KeyValue *keyValue; // KeyValue
|
||||||
const VariantList *list; // VariantList
|
const VariantList *list; // VariantList
|
||||||
const String *string; // String
|
const String *string; // String
|
||||||
|
StringId stringId; // StringId
|
||||||
} ConfigOptionValueType;
|
} ConfigOptionValueType;
|
||||||
|
|
||||||
typedef struct ConfigOptionValue
|
typedef struct ConfigOptionValue
|
||||||
|
@ -327,7 +327,7 @@ cfgLoadUpdateOption(void)
|
|||||||
// Set compress-type to none. Eventually the compress option will be deprecated and removed so this reduces code churn
|
// Set compress-type to none. Eventually the compress option will be deprecated and removed so this reduces code churn
|
||||||
// when that happens.
|
// when that happens.
|
||||||
if (!cfgOptionBool(cfgOptCompress) && cfgOptionSource(cfgOptCompressType) == cfgSourceDefault)
|
if (!cfgOptionBool(cfgOptCompress) && cfgOptionSource(cfgOptCompressType) == cfgSourceDefault)
|
||||||
cfgOptionSet(cfgOptCompressType, cfgSourceParam, VARSTR(compressTypeStr(compressTypeNone)));
|
cfgOptionSet(cfgOptCompressType, cfgSourceParam, VARUINT64(CFGOPTVAL_COMPRESS_TYPE_NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now invalidate compress so it can't be used and won't be passed to child processes
|
// Now invalidate compress so it can't be used and won't be passed to child processes
|
||||||
@ -385,7 +385,7 @@ cfgLoadLogFile(void)
|
|||||||
|
|
||||||
// Attempt to open log file
|
// Attempt to open log file
|
||||||
if (!logFileSet(strZ(logFile)))
|
if (!logFileSet(strZ(logFile)))
|
||||||
cfgOptionSet(cfgOptLogLevelFile, cfgSourceParam, varNewStrZ("off"));
|
cfgOptionSet(cfgOptLogLevelFile, cfgSourceParam, VARUINT64(CFGOPTVAL_LOG_LEVEL_CONSOLE_OFF));
|
||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
}
|
}
|
||||||
|
@ -890,7 +890,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("archive-mode"),
|
PARSE_RULE_OPTION_NAME("archive-mode"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -912,6 +912,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdPreserve),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_preserve_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_preserve_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1354,7 +1355,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("compress-type"),
|
PARSE_RULE_OPTION_NAME("compress-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -1385,6 +1386,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdGz),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_gz_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_gz_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2320,7 +2322,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("log-level-console"),
|
PARSE_RULE_OPTION_NAME("log-level-console"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -2400,6 +2402,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdWarn),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_warn_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_warn_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2410,7 +2413,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("log-level-file"),
|
PARSE_RULE_OPTION_NAME("log-level-file"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -2490,6 +2493,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdInfo),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_info_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_info_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2500,7 +2504,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("log-level-stderr"),
|
PARSE_RULE_OPTION_NAME("log-level-stderr"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -2580,6 +2584,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdWarn),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_warn_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_warn_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2961,7 +2966,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("output"),
|
PARSE_RULE_OPTION_NAME("output"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
||||||
|
|
||||||
@ -2983,6 +2988,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdText),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_text_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_text_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -3526,7 +3532,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("pg-host-type"),
|
PARSE_RULE_OPTION_NAME("pg-host-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -3577,6 +3583,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdSsh),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_ssh_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_ssh_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -4152,7 +4159,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("remote-type"),
|
PARSE_RULE_OPTION_NAME("remote-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_REQUIRED(false),
|
PARSE_RULE_OPTION_REQUIRED(false),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
||||||
|
|
||||||
@ -4585,7 +4592,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-azure-key-type"),
|
PARSE_RULE_OPTION_NAME("repo-azure-key-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -4663,6 +4670,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdShared),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_shared_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_shared_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -4673,7 +4681,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-azure-uri-style"),
|
PARSE_RULE_OPTION_NAME("repo-azure-uri-style"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -4751,6 +4759,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdHost),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_host_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_host_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -4840,7 +4849,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-cipher-type"),
|
PARSE_RULE_OPTION_NAME("repo-cipher-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -4913,6 +4922,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdNone),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_none_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_none_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -5159,7 +5169,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-gcs-key-type"),
|
PARSE_RULE_OPTION_NAME("repo-gcs-key-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -5238,6 +5248,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdService),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_service_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_service_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -5878,7 +5889,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-host-type"),
|
PARSE_RULE_OPTION_NAME("repo-host-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -5938,6 +5949,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdSsh),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_ssh_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_ssh_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -6176,7 +6188,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-retention-archive-type"),
|
PARSE_RULE_OPTION_NAME("repo-retention-archive-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -6202,6 +6214,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdFull),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_full_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_full_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -6272,7 +6285,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-retention-full-type"),
|
PARSE_RULE_OPTION_NAME("repo-retention-full-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -6297,6 +6310,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdCount),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_count_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_count_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -6651,7 +6665,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-s3-key-type"),
|
PARSE_RULE_OPTION_NAME("repo-s3-key-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -6730,6 +6744,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdShared),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_shared_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_shared_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -6973,7 +6988,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-s3-uri-style"),
|
PARSE_RULE_OPTION_NAME("repo-s3-uri-style"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -7051,6 +7066,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdHost),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_host_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_host_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -7472,7 +7488,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("repo-type"),
|
PARSE_RULE_OPTION_NAME("repo-type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_RESET(true),
|
PARSE_RULE_OPTION_RESET(true),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),
|
||||||
@ -7548,6 +7564,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdPosix),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_posix_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_posix_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -7789,7 +7806,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("sort"),
|
PARSE_RULE_OPTION_NAME("sort"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
||||||
|
|
||||||
@ -7811,6 +7828,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdAsc),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_asc_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_asc_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -8081,7 +8099,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("target-action"),
|
PARSE_RULE_OPTION_NAME("target-action"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
||||||
|
|
||||||
@ -8113,6 +8131,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdPause),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_pause_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_pause_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -8561,7 +8580,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
PARSE_RULE_OPTION
|
PARSE_RULE_OPTION
|
||||||
(
|
(
|
||||||
PARSE_RULE_OPTION_NAME("type"),
|
PARSE_RULE_OPTION_NAME("type"),
|
||||||
PARSE_RULE_OPTION_TYPE(cfgOptTypeString),
|
PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),
|
||||||
PARSE_RULE_OPTION_REQUIRED(true),
|
PARSE_RULE_OPTION_REQUIRED(true),
|
||||||
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
PARSE_RULE_OPTION_SECTION(cfgSectionCommandLine),
|
||||||
|
|
||||||
@ -8589,6 +8608,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdIncr),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_incr_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_incr_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -8615,6 +8635,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
|
|||||||
|
|
||||||
PARSE_RULE_OPTIONAL_DEFAULT
|
PARSE_RULE_OPTIONAL_DEFAULT
|
||||||
(
|
(
|
||||||
|
PARSE_RULE_VAL_STRID(parseRuleValStrIdDefault),
|
||||||
PARSE_RULE_VAL_STR(parseRuleValStrQT_default_QT),
|
PARSE_RULE_VAL_STR(parseRuleValStrQT_default_QT),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -117,7 +117,7 @@ Define how an option is parsed and interacts with other options
|
|||||||
typedef struct ParseRuleOption
|
typedef struct ParseRuleOption
|
||||||
{
|
{
|
||||||
const char *name; // Name
|
const char *name; // Name
|
||||||
unsigned int type:3; // e.g. string, int, boolean
|
unsigned int type:4; // e.g. string, int, boolean
|
||||||
bool negate:1; // Can the option be negated on the command line?
|
bool negate:1; // Can the option be negated on the command line?
|
||||||
bool reset:1; // Can the option be reset on the command line?
|
bool reset:1; // Can the option be reset on the command line?
|
||||||
bool required:1; // Is the option required?
|
bool required:1; // Is the option required?
|
||||||
@ -687,6 +687,9 @@ cfgParseOptionDataType(const ConfigOption optionId)
|
|||||||
case cfgOptTypeList:
|
case cfgOptTypeList:
|
||||||
FUNCTION_TEST_RETURN(cfgOptDataTypeList);
|
FUNCTION_TEST_RETURN(cfgOptDataTypeList);
|
||||||
|
|
||||||
|
case cfgOptTypeStringId:
|
||||||
|
FUNCTION_TEST_RETURN(cfgOptDataTypeStringId);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -747,9 +750,6 @@ cfgParseOptionalFilterDepend(PackRead *const filter, const Config *const config,
|
|||||||
// If a depend list exists, make sure the value is in the list
|
// If a depend list exists, make sure the value is in the list
|
||||||
if (pckReadNext(filter))
|
if (pckReadNext(filter))
|
||||||
{
|
{
|
||||||
const StringId dependValueStrId = cfgParseOptionDataType(dependId) == cfgOptDataTypeString ?
|
|
||||||
strIdFromStr(dependValue->value.string) : 0;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
switch (cfgParseOptionDataType(dependId))
|
switch (cfgParseOptionDataType(dependId))
|
||||||
@ -760,9 +760,9 @@ cfgParseOptionalFilterDepend(PackRead *const filter, const Config *const config,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ASSERT(cfgParseOptionDataType(dependId) == cfgOptDataTypeString);
|
ASSERT(cfgParseOptionDataType(dependId) == cfgOptDataTypeStringId);
|
||||||
|
|
||||||
if (parseRuleValueStrId[pckReadU32P(filter)] == dependValueStrId)
|
if (parseRuleValueStrId[pckReadU32P(filter)] == dependValue->value.stringId)
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -962,6 +962,11 @@ cfgParseOptionalRule(
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case cfgOptTypeStringId:
|
||||||
|
optionalRules->defaultValue.stringId = parseRuleValueStrId[pckReadU32P(ruleData)];
|
||||||
|
optionalRules->defaultRaw = (const String *)&parseRuleValueStr[pckReadU32P(ruleData)];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2126,7 +2131,7 @@ configParse(const Storage *storage, unsigned int argListSize, const char *argLis
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ASSERT(cfgParseOptionDataType(dependId) == cfgOptDataTypeString);
|
ASSERT(cfgParseOptionDataType(dependId) == cfgOptDataTypeStringId);
|
||||||
|
|
||||||
String *const errorList = strNew();
|
String *const errorList = strNew();
|
||||||
unsigned int validSize = 0;
|
unsigned int validSize = 0;
|
||||||
@ -2267,6 +2272,11 @@ configParse(const Storage *storage, unsigned int argListSize, const char *argLis
|
|||||||
cfgParseOptionKeyIdxName(optionId, optionKeyIdx));
|
cfgParseOptionKeyIdxName(optionId, optionKeyIdx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Else if StringId
|
||||||
|
else if (optionType == cfgOptTypeStringId)
|
||||||
|
{
|
||||||
|
configOptionValue->value.stringId = strIdFromZN(strZ(valueAllow), strSize(valueAllow), false);
|
||||||
|
}
|
||||||
// Else if string make sure it is valid
|
// Else if string make sure it is valid
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2324,13 +2334,11 @@ configParse(const Storage *storage, unsigned int argListSize, const char *argLis
|
|||||||
PackRead *const allowList = pckReadNewC(optionalRules.allowList, optionalRules.allowListSize);
|
PackRead *const allowList = pckReadNewC(optionalRules.allowList, optionalRules.allowListSize);
|
||||||
bool allowListFound = false;
|
bool allowListFound = false;
|
||||||
|
|
||||||
if (parseRuleOption[optionId].type == cfgOptTypeString)
|
if (parseRuleOption[optionId].type == cfgOptTypeStringId)
|
||||||
{
|
{
|
||||||
const StringId value = strIdFromZN(strZ(valueAllow), strSize(valueAllow), false);
|
|
||||||
|
|
||||||
while (pckReadNext(allowList))
|
while (pckReadNext(allowList))
|
||||||
{
|
{
|
||||||
if (parseRuleValueStrId[pckReadU32P(allowList)] == value)
|
if (parseRuleValueStrId[pckReadU32P(allowList)] == configOptionValue->value.stringId)
|
||||||
{
|
{
|
||||||
allowListFound = true;
|
allowListFound = true;
|
||||||
break;
|
break;
|
||||||
|
@ -19,6 +19,7 @@ typedef enum
|
|||||||
cfgOptTypePath, // Path string with validation
|
cfgOptTypePath, // Path string with validation
|
||||||
cfgOptTypeSize, // Size, e.g. 1m, 2gb
|
cfgOptTypeSize, // Size, e.g. 1m, 2gb
|
||||||
cfgOptTypeString, // String
|
cfgOptTypeString, // String
|
||||||
|
cfgOptTypeStringId, // StringId
|
||||||
cfgOptTypeTime, // Time in seconds, e.g. 23, 1.5
|
cfgOptTypeTime, // Time in seconds, e.g. 23, 1.5
|
||||||
} ConfigOptionType;
|
} ConfigOptionType;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ typedef enum
|
|||||||
cfgOptDataTypeInteger, // Signed 64-bit integer
|
cfgOptDataTypeInteger, // Signed 64-bit integer
|
||||||
cfgOptDataTypeList, // List
|
cfgOptDataTypeList, // List
|
||||||
cfgOptDataTypeString, // String
|
cfgOptDataTypeString, // String
|
||||||
|
cfgOptDataTypeStringId, // StringId
|
||||||
} ConfigOptionDataType;
|
} ConfigOptionDataType;
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -163,7 +163,7 @@ protocolLocalParam(ProtocolStorageType protocolStorageType, unsigned int hostIdx
|
|||||||
// Only enable file logging on the local when requested
|
// Only enable file logging on the local when requested
|
||||||
kvPut(
|
kvPut(
|
||||||
optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_FILE),
|
optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_FILE),
|
||||||
cfgOptionBool(cfgOptLogSubprocess) ? VARSTR(cfgOptionStr(cfgOptLogLevelFile)) : VARSTRDEF("off"));
|
cfgOptionBool(cfgOptLogSubprocess) ? VARUINT64(cfgOptionStrId(cfgOptLogLevelFile)) : VARSTRDEF("off"));
|
||||||
|
|
||||||
// Always output errors on stderr for debugging purposes
|
// Always output errors on stderr for debugging purposes
|
||||||
kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_STDERR), VARSTRDEF("error"));
|
kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_STDERR), VARSTRDEF("error"));
|
||||||
@ -551,7 +551,7 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int hostId
|
|||||||
// Only enable file logging on the remote when requested
|
// Only enable file logging on the remote when requested
|
||||||
kvPut(
|
kvPut(
|
||||||
optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_FILE),
|
optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_FILE),
|
||||||
cfgOptionBool(cfgOptLogSubprocess) ? VARSTR(cfgOptionStr(cfgOptLogLevelFile)) : VARSTRDEF("off"));
|
cfgOptionBool(cfgOptLogSubprocess) ? VARUINT64(cfgOptionStrId(cfgOptLogLevelFile)) : VARSTRDEF("off"));
|
||||||
|
|
||||||
// Always output errors on stderr for debugging purposes
|
// Always output errors on stderr for debugging purposes
|
||||||
kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_STDERR), VARSTRDEF("error"));
|
kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_STDERR), VARSTRDEF("error"));
|
||||||
@ -777,7 +777,7 @@ protocolRemoteGet(ProtocolStorageType protocolStorageType, unsigned int hostIdx)
|
|||||||
|
|
||||||
VariantList *optionList = configOptionRemote(protocolHelperClient->client, param);
|
VariantList *optionList = configOptionRemote(protocolHelperClient->client, param);
|
||||||
|
|
||||||
if (!strEq(varStr(varLstGet(optionList, 0)), strIdToStr(cipherTypeNone)))
|
if (varUInt64(varLstGet(optionList, 0)) != cipherTypeNone)
|
||||||
{
|
{
|
||||||
cfgOptionIdxSet(cfgOptRepoCipherType, hostIdx, cfgSourceConfig, varLstGet(optionList, 0));
|
cfgOptionIdxSet(cfgOptRepoCipherType, hostIdx, cfgSourceConfig, varLstGet(optionList, 0));
|
||||||
cfgOptionIdxSet(cfgOptRepoCipherPass, hostIdx, cfgSourceConfig, varLstGet(optionList, 1));
|
cfgOptionIdxSet(cfgOptRepoCipherPass, hostIdx, cfgSourceConfig, varLstGet(optionList, 1));
|
||||||
|
@ -250,6 +250,16 @@ testRun(void)
|
|||||||
" command-role:\n"
|
" command-role:\n"
|
||||||
" main: {}\n"
|
" main: {}\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
" compress-network:\n"
|
||||||
|
" section: global\n"
|
||||||
|
" type: string-id\n"
|
||||||
|
" command:\n"
|
||||||
|
" backup:\n"
|
||||||
|
" allow-list:\n"
|
||||||
|
" - gz\n"
|
||||||
|
" command-role:\n"
|
||||||
|
" main: {}\n"
|
||||||
|
"\n"
|
||||||
" compress-type:\n"
|
" compress-type:\n"
|
||||||
" section: global\n"
|
" section: global\n"
|
||||||
" type: string\n"
|
" type: string\n"
|
||||||
@ -301,7 +311,7 @@ testRun(void)
|
|||||||
"\n"
|
"\n"
|
||||||
" log-level-console:\n"
|
" log-level-console:\n"
|
||||||
" section: global\n"
|
" section: global\n"
|
||||||
" type: string\n"
|
" type: string-id\n"
|
||||||
" default: warn\n"
|
" default: warn\n"
|
||||||
" allow-list:\n"
|
" allow-list:\n"
|
||||||
" - off\n"
|
" - off\n"
|
||||||
@ -311,7 +321,7 @@ testRun(void)
|
|||||||
"\n"
|
"\n"
|
||||||
" log-level-file:\n"
|
" log-level-file:\n"
|
||||||
" section: global\n"
|
" section: global\n"
|
||||||
" type: string\n"
|
" type: string-id\n"
|
||||||
" default: info\n"
|
" default: info\n"
|
||||||
" allow-list: log-level-console\n"
|
" allow-list: log-level-console\n"
|
||||||
" command:\n"
|
" command:\n"
|
||||||
@ -429,6 +439,7 @@ testRun(void)
|
|||||||
"#define CFGOPT_BUFFER_SIZE \"buffer-size\"\n"
|
"#define CFGOPT_BUFFER_SIZE \"buffer-size\"\n"
|
||||||
"#define CFGOPT_COMPRESS_LEVEL \"compress-level\"\n"
|
"#define CFGOPT_COMPRESS_LEVEL \"compress-level\"\n"
|
||||||
"#define CFGOPT_COMPRESS_LEVEL_NETWORK \"compress-level-network\"\n"
|
"#define CFGOPT_COMPRESS_LEVEL_NETWORK \"compress-level-network\"\n"
|
||||||
|
"#define CFGOPT_COMPRESS_NETWORK \"compress-network\"\n"
|
||||||
"#define CFGOPT_COMPRESS_TYPE \"compress-type\"\n"
|
"#define CFGOPT_COMPRESS_TYPE \"compress-type\"\n"
|
||||||
"#define CFGOPT_CONFIG \"config\"\n"
|
"#define CFGOPT_CONFIG \"config\"\n"
|
||||||
"#define CFGOPT_CONFIG_INCLUDE \"config-include\"\n"
|
"#define CFGOPT_CONFIG_INCLUDE \"config-include\"\n"
|
||||||
@ -438,11 +449,14 @@ testRun(void)
|
|||||||
"#define CFGOPT_STANZA \"stanza\"\n"
|
"#define CFGOPT_STANZA \"stanza\"\n"
|
||||||
"#define CFGOPT_TIMEOUT \"timeout\"\n"
|
"#define CFGOPT_TIMEOUT \"timeout\"\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#define CFG_OPTION_TOTAL 14\n"
|
"#define CFG_OPTION_TOTAL 15\n"
|
||||||
"\n"
|
"\n"
|
||||||
COMMENT_BLOCK_BEGIN "\n"
|
COMMENT_BLOCK_BEGIN "\n"
|
||||||
"Option value constants\n"
|
"Option value constants\n"
|
||||||
COMMENT_BLOCK_END "\n"
|
COMMENT_BLOCK_END "\n"
|
||||||
|
"#define CFGOPTVAL_COMPRESS_NETWORK_GZ STRID5(\"gz\", 0x3470)\n"
|
||||||
|
"#define CFGOPTVAL_COMPRESS_NETWORK_GZ_Z \"gz\"\n"
|
||||||
|
"\n"
|
||||||
"#define CFGOPTVAL_LOG_LEVEL_CONSOLE_DEBUG1 STRID6(\"debug1\", 0x7475421441)\n"
|
"#define CFGOPTVAL_LOG_LEVEL_CONSOLE_DEBUG1 STRID6(\"debug1\", 0x7475421441)\n"
|
||||||
"#define CFGOPTVAL_LOG_LEVEL_CONSOLE_DEBUG1_Z \"debug1\"\n"
|
"#define CFGOPTVAL_LOG_LEVEL_CONSOLE_DEBUG1_Z \"debug1\"\n"
|
||||||
"#define CFGOPTVAL_LOG_LEVEL_CONSOLE_ERROR STRID5(\"error\", 0x127ca450)\n"
|
"#define CFGOPTVAL_LOG_LEVEL_CONSOLE_ERROR STRID5(\"error\", 0x127ca450)\n"
|
||||||
@ -491,6 +505,7 @@ testRun(void)
|
|||||||
" cfgOptBufferSize,\n"
|
" cfgOptBufferSize,\n"
|
||||||
" cfgOptCompressLevel,\n"
|
" cfgOptCompressLevel,\n"
|
||||||
" cfgOptCompressLevelNetwork,\n"
|
" cfgOptCompressLevelNetwork,\n"
|
||||||
|
" cfgOptCompressNetwork,\n"
|
||||||
" cfgOptCompressType,\n"
|
" cfgOptCompressType,\n"
|
||||||
" cfgOptConfig,\n"
|
" cfgOptConfig,\n"
|
||||||
" cfgOptConfigInclude,\n"
|
" cfgOptConfigInclude,\n"
|
||||||
@ -561,6 +576,7 @@ testRun(void)
|
|||||||
"{\n"
|
"{\n"
|
||||||
" STRID6(\"debug1\", 0x7475421441),\n"
|
" STRID6(\"debug1\", 0x7475421441),\n"
|
||||||
" STRID5(\"error\", 0x127ca450),\n"
|
" STRID5(\"error\", 0x127ca450),\n"
|
||||||
|
" STRID5(\"gz\", 0x3470),\n"
|
||||||
" STRID5(\"info\", 0x799c90),\n"
|
" STRID5(\"info\", 0x799c90),\n"
|
||||||
" STRID5(\"off\", 0x18cf0),\n"
|
" STRID5(\"off\", 0x18cf0),\n"
|
||||||
" STRID5(\"warn\", 0x748370),\n"
|
" STRID5(\"warn\", 0x748370),\n"
|
||||||
@ -570,6 +586,7 @@ testRun(void)
|
|||||||
"{\n"
|
"{\n"
|
||||||
" parseRuleValStrIdDebug1,\n"
|
" parseRuleValStrIdDebug1,\n"
|
||||||
" parseRuleValStrIdError,\n"
|
" parseRuleValStrIdError,\n"
|
||||||
|
" parseRuleValStrIdGz,\n"
|
||||||
" parseRuleValStrIdInfo,\n"
|
" parseRuleValStrIdInfo,\n"
|
||||||
" parseRuleValStrIdOff,\n"
|
" parseRuleValStrIdOff,\n"
|
||||||
" parseRuleValStrIdWarn,\n"
|
" parseRuleValStrIdWarn,\n"
|
||||||
@ -923,6 +940,37 @@ testRun(void)
|
|||||||
COMMENT_SEPARATOR "\n"
|
COMMENT_SEPARATOR "\n"
|
||||||
" PARSE_RULE_OPTION\n"
|
" PARSE_RULE_OPTION\n"
|
||||||
" (\n"
|
" (\n"
|
||||||
|
" PARSE_RULE_OPTION_NAME(\"compress-network\"),\n"
|
||||||
|
" PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),\n"
|
||||||
|
" PARSE_RULE_OPTION_RESET(true),\n"
|
||||||
|
" PARSE_RULE_OPTION_REQUIRED(true),\n"
|
||||||
|
" PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),\n"
|
||||||
|
"\n"
|
||||||
|
" PARSE_RULE_OPTION_COMMAND_ROLE_MAIN_VALID_LIST\n"
|
||||||
|
" (\n"
|
||||||
|
" PARSE_RULE_OPTION_COMMAND(cfgCmdBackup)\n"
|
||||||
|
" ),\n"
|
||||||
|
"\n"
|
||||||
|
" PARSE_RULE_OPTIONAL\n"
|
||||||
|
" (\n"
|
||||||
|
" PARSE_RULE_OPTIONAL_GROUP\n"
|
||||||
|
" (\n"
|
||||||
|
" PARSE_RULE_FILTER_CMD\n"
|
||||||
|
" (\n"
|
||||||
|
" PARSE_RULE_VAL_CMD(cfgCmdBackup),\n"
|
||||||
|
" ),\n"
|
||||||
|
"\n"
|
||||||
|
" PARSE_RULE_OPTIONAL_ALLOW_LIST\n"
|
||||||
|
" (\n"
|
||||||
|
" PARSE_RULE_VAL_STRID(parseRuleValStrIdGz),\n"
|
||||||
|
" ),\n"
|
||||||
|
" ),\n"
|
||||||
|
" ),\n"
|
||||||
|
" ),\n"
|
||||||
|
"\n"
|
||||||
|
COMMENT_SEPARATOR "\n"
|
||||||
|
" PARSE_RULE_OPTION\n"
|
||||||
|
" (\n"
|
||||||
" PARSE_RULE_OPTION_NAME(\"compress-type\"),\n"
|
" PARSE_RULE_OPTION_NAME(\"compress-type\"),\n"
|
||||||
" PARSE_RULE_OPTION_TYPE(cfgOptTypeString),\n"
|
" PARSE_RULE_OPTION_TYPE(cfgOptTypeString),\n"
|
||||||
" PARSE_RULE_OPTION_RESET(true),\n"
|
" PARSE_RULE_OPTION_RESET(true),\n"
|
||||||
@ -1047,7 +1095,7 @@ testRun(void)
|
|||||||
" PARSE_RULE_OPTION\n"
|
" PARSE_RULE_OPTION\n"
|
||||||
" (\n"
|
" (\n"
|
||||||
" PARSE_RULE_OPTION_NAME(\"log-level-console\"),\n"
|
" PARSE_RULE_OPTION_NAME(\"log-level-console\"),\n"
|
||||||
" PARSE_RULE_OPTION_TYPE(cfgOptTypeString),\n"
|
" PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),\n"
|
||||||
" PARSE_RULE_OPTION_RESET(true),\n"
|
" PARSE_RULE_OPTION_RESET(true),\n"
|
||||||
" PARSE_RULE_OPTION_REQUIRED(true),\n"
|
" PARSE_RULE_OPTION_REQUIRED(true),\n"
|
||||||
" PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),\n"
|
" PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),\n"
|
||||||
@ -1089,6 +1137,7 @@ testRun(void)
|
|||||||
"\n"
|
"\n"
|
||||||
" PARSE_RULE_OPTIONAL_DEFAULT\n"
|
" PARSE_RULE_OPTIONAL_DEFAULT\n"
|
||||||
" (\n"
|
" (\n"
|
||||||
|
" PARSE_RULE_VAL_STRID(parseRuleValStrIdWarn),\n"
|
||||||
" PARSE_RULE_VAL_STR(parseRuleValStrQT_warn_QT),\n"
|
" PARSE_RULE_VAL_STR(parseRuleValStrQT_warn_QT),\n"
|
||||||
" ),\n"
|
" ),\n"
|
||||||
" ),\n"
|
" ),\n"
|
||||||
@ -1099,7 +1148,7 @@ testRun(void)
|
|||||||
" PARSE_RULE_OPTION\n"
|
" PARSE_RULE_OPTION\n"
|
||||||
" (\n"
|
" (\n"
|
||||||
" PARSE_RULE_OPTION_NAME(\"log-level-file\"),\n"
|
" PARSE_RULE_OPTION_NAME(\"log-level-file\"),\n"
|
||||||
" PARSE_RULE_OPTION_TYPE(cfgOptTypeString),\n"
|
" PARSE_RULE_OPTION_TYPE(cfgOptTypeStringId),\n"
|
||||||
" PARSE_RULE_OPTION_RESET(true),\n"
|
" PARSE_RULE_OPTION_RESET(true),\n"
|
||||||
" PARSE_RULE_OPTION_REQUIRED(true),\n"
|
" PARSE_RULE_OPTION_REQUIRED(true),\n"
|
||||||
" PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),\n"
|
" PARSE_RULE_OPTION_SECTION(cfgSectionGlobal),\n"
|
||||||
@ -1149,6 +1198,7 @@ testRun(void)
|
|||||||
"\n"
|
"\n"
|
||||||
" PARSE_RULE_OPTIONAL_DEFAULT\n"
|
" PARSE_RULE_OPTIONAL_DEFAULT\n"
|
||||||
" (\n"
|
" (\n"
|
||||||
|
" PARSE_RULE_VAL_STRID(parseRuleValStrIdWarn),\n"
|
||||||
" PARSE_RULE_VAL_STR(parseRuleValStrQT_warn_QT),\n"
|
" PARSE_RULE_VAL_STR(parseRuleValStrQT_warn_QT),\n"
|
||||||
" ),\n"
|
" ),\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -1167,6 +1217,7 @@ testRun(void)
|
|||||||
"\n"
|
"\n"
|
||||||
" PARSE_RULE_OPTIONAL_DEFAULT\n"
|
" PARSE_RULE_OPTIONAL_DEFAULT\n"
|
||||||
" (\n"
|
" (\n"
|
||||||
|
" PARSE_RULE_VAL_STRID(parseRuleValStrIdInfo),\n"
|
||||||
" PARSE_RULE_VAL_STR(parseRuleValStrQT_info_QT),\n"
|
" PARSE_RULE_VAL_STR(parseRuleValStrQT_info_QT),\n"
|
||||||
" ),\n"
|
" ),\n"
|
||||||
" ),\n"
|
" ),\n"
|
||||||
@ -1488,6 +1539,7 @@ testRun(void)
|
|||||||
"{\n"
|
"{\n"
|
||||||
" cfgOptStanza,\n"
|
" cfgOptStanza,\n"
|
||||||
" cfgOptBufferSize,\n"
|
" cfgOptBufferSize,\n"
|
||||||
|
" cfgOptCompressNetwork,\n"
|
||||||
" cfgOptConfig,\n"
|
" cfgOptConfig,\n"
|
||||||
" cfgOptConfigInclude,\n"
|
" cfgOptConfigInclude,\n"
|
||||||
" cfgOptLogLevelConsole,\n"
|
" cfgOptLogLevelConsole,\n"
|
||||||
|
@ -45,12 +45,12 @@ testRun(void)
|
|||||||
TEST_TITLE("missing directory");
|
TEST_TITLE("missing directory");
|
||||||
|
|
||||||
Buffer *output = bufNew(0);
|
Buffer *output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_TEXT));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "missing directory (text)");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "missing directory (text)");
|
||||||
TEST_RESULT_STR_Z(strNewBuf(output), "", "check output");
|
TEST_RESULT_STR_Z(strNewBuf(output), "", "check output");
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("json"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_JSON));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "missing directory (json)");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "missing directory (json)");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
strNewBuf(output),
|
strNewBuf(output),
|
||||||
@ -65,12 +65,12 @@ testRun(void)
|
|||||||
HRN_STORAGE_PATH_CREATE(storageRepoWrite(), NULL, .mode = 0700);
|
HRN_STORAGE_PATH_CREATE(storageRepoWrite(), NULL, .mode = 0700);
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_TEXT));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "empty directory (text)");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "empty directory (text)");
|
||||||
TEST_RESULT_STR_Z(strNewBuf(output), "", "check output");
|
TEST_RESULT_STR_Z(strNewBuf(output), "", "check output");
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("json"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_JSON));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "empty directory (json)");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "empty directory (json)");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
strNewBuf(output),
|
strNewBuf(output),
|
||||||
@ -99,7 +99,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("add path and file");
|
TEST_TITLE("add path and file");
|
||||||
|
|
||||||
cfgOptionSet(cfgOptSort, cfgSourceParam, VARSTRDEF("asc"));
|
cfgOptionSet(cfgOptSort, cfgSourceParam, VARUINT64(CFGOPTVAL_SORT_ASC));
|
||||||
|
|
||||||
HRN_STORAGE_PATH_CREATE(storageRepoWrite(), "bbb");
|
HRN_STORAGE_PATH_CREATE(storageRepoWrite(), "bbb");
|
||||||
HRN_STORAGE_PUT_Z(storageRepoWrite(), "aaa", "TESTDATA", .timeModified = 1578671569);
|
HRN_STORAGE_PUT_Z(storageRepoWrite(), "aaa", "TESTDATA", .timeModified = 1578671569);
|
||||||
@ -109,12 +109,12 @@ testRun(void)
|
|||||||
HRN_SYSTEM("mkfifo " TEST_PATH "/repo/pipe");
|
HRN_SYSTEM("mkfifo " TEST_PATH "/repo/pipe");
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_TEXT));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "path and file (text)");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "path and file (text)");
|
||||||
TEST_RESULT_STR_Z(strNewBuf(output), "aaa\nbbb\nlink\npipe\n", "check output");
|
TEST_RESULT_STR_Z(strNewBuf(output), "aaa\nbbb\nlink\npipe\n", "check output");
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("json"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_JSON));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "path and file (json)");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "path and file (json)");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
strNewBuf(output),
|
strNewBuf(output),
|
||||||
@ -130,10 +130,10 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("reverse sort");
|
TEST_TITLE("reverse sort");
|
||||||
|
|
||||||
cfgOptionSet(cfgOptSort, cfgSourceParam, VARSTRDEF("desc"));
|
cfgOptionSet(cfgOptSort, cfgSourceParam, VARUINT64(CFGOPTVAL_SORT_DESC));
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_TEXT));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "path and file (text)");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "path and file (text)");
|
||||||
TEST_RESULT_STR_Z(strNewBuf(output), "pipe\nlink\nbbb\naaa\n", "check output");
|
TEST_RESULT_STR_Z(strNewBuf(output), "pipe\nlink\nbbb\naaa\n", "check output");
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ testRun(void)
|
|||||||
cfgOptionSet(cfgOptRecurse, cfgSourceParam, VARBOOL(true));
|
cfgOptionSet(cfgOptRecurse, cfgSourceParam, VARBOOL(true));
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_TEXT));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "filter");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "filter");
|
||||||
TEST_RESULT_STR_Z(strNewBuf(output), "pipe\nlink\nbbb/ccc\nbbb\naaa\n", "check output");
|
TEST_RESULT_STR_Z(strNewBuf(output), "pipe\nlink\nbbb/ccc\nbbb\naaa\n", "check output");
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ testRun(void)
|
|||||||
cfgOptionSet(cfgOptFilter, cfgSourceParam, VARSTRDEF("^aaa$"));
|
cfgOptionSet(cfgOptFilter, cfgSourceParam, VARSTRDEF("^aaa$"));
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_TEXT));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "filter");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "filter");
|
||||||
TEST_RESULT_STR_Z(strNewBuf(output), "aaa\n", "check output");
|
TEST_RESULT_STR_Z(strNewBuf(output), "aaa\n", "check output");
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ testRun(void)
|
|||||||
HRN_CFG_LOAD(cfgCmdRepoLs, argListTmp);
|
HRN_CFG_LOAD(cfgCmdRepoLs, argListTmp);
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARUINT64(CFGOPTVAL_OUTPUT_TEXT));
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "subdirectory");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "subdirectory");
|
||||||
TEST_RESULT_STR_Z(strNewBuf(output), "ccc\n", "check output");
|
TEST_RESULT_STR_Z(strNewBuf(output), "ccc\n", "check output");
|
||||||
|
|
||||||
|
@ -1479,7 +1479,6 @@ testRun(void)
|
|||||||
TEST_RESULT_BOOL(cfgOptionNegate(cfgOptConfig), true, "config is negated");
|
TEST_RESULT_BOOL(cfgOptionNegate(cfgOptConfig), true, "config is negated");
|
||||||
TEST_RESULT_INT(cfgOptionSource(cfgOptStanza), cfgSourceParam, "stanza is source param");
|
TEST_RESULT_INT(cfgOptionSource(cfgOptStanza), cfgSourceParam, "stanza is source param");
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptStanza), "db", "stanza is set");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptStanza), "db", "stanza is set");
|
||||||
TEST_RESULT_UINT(cfgOptionStrId(cfgOptStanza), strIdFromZ("db"), "stanza is set");
|
|
||||||
TEST_RESULT_INT(cfgOptionSource(cfgOptStanza), cfgSourceParam, "stanza is source param");
|
TEST_RESULT_INT(cfgOptionSource(cfgOptStanza), cfgSourceParam, "stanza is source param");
|
||||||
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgPath, 0), "/path/to/db", "pg1-path is set");
|
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgPath, 0), "/path/to/db", "pg1-path is set");
|
||||||
TEST_RESULT_INT(cfgOptionSource(cfgOptPgPath), cfgSourceParam, "pg1-path is source param");
|
TEST_RESULT_INT(cfgOptionSource(cfgOptPgPath), cfgSourceParam, "pg1-path is source param");
|
||||||
@ -1642,6 +1641,9 @@ testRun(void)
|
|||||||
TEST_RESULT_INT(cfgOptionSource(cfgOptPgPath), cfgSourceConfig, "pg1-path is source config");
|
TEST_RESULT_INT(cfgOptionSource(cfgOptPgPath), cfgSourceConfig, "pg1-path is source config");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
cfgOptionIdxStr(cfgOptPgPath, cfgOptionKeyToIdx(cfgOptPgPath, 256)), "/path/to/db256", "pg256-path is set");
|
cfgOptionIdxStr(cfgOptPgPath, cfgOptionKeyToIdx(cfgOptPgPath, 256)), "/path/to/db256", "pg256-path is set");
|
||||||
|
TEST_RESULT_UINT(varUInt64(cfgOptionVar(cfgOptType)), STRID5("incr", 0x90dc90), "check type");
|
||||||
|
TEST_RESULT_STR_Z(
|
||||||
|
cfgOptionDisplayVar(VARUINT64(STRID5("incr", 0x90dc90)), cfgOptTypeStringId), "incr", "check type display");
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptLockPath), "/", "lock-path is set");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptLockPath), "/", "lock-path is set");
|
||||||
TEST_RESULT_INT(cfgOptionSource(cfgOptLockPath), cfgSourceConfig, "lock-path is source config");
|
TEST_RESULT_INT(cfgOptionSource(cfgOptLockPath), cfgSourceConfig, "lock-path is source config");
|
||||||
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgSocketPath, 0), "/path/to/socket", "pg1-socket-path is set");
|
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgSocketPath, 0), "/path/to/socket", "pg1-socket-path is set");
|
||||||
@ -1883,6 +1885,12 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(cfgOptionIdxSet(cfgOptPgPath, 0, cfgSourceParam, VARSTRDEF("/new")), "set pg1-path");
|
TEST_RESULT_VOID(cfgOptionIdxSet(cfgOptPgPath, 0, cfgSourceParam, VARSTRDEF("/new")), "set pg1-path");
|
||||||
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgPath, 0), "/new", "check pg1-path");
|
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgPath, 0), "/new", "check pg1-path");
|
||||||
|
|
||||||
|
TEST_RESULT_VOID(cfgOptionIdxSet(cfgOptType, 0, cfgSourceParam, VARUINT64(STRID5("preserve", 0x2da45996500))), "set type");
|
||||||
|
TEST_RESULT_UINT(cfgOptionIdxStrId(cfgOptType, 0), STRID5("preserve", 0x2da45996500), "check type");
|
||||||
|
|
||||||
|
TEST_RESULT_VOID(cfgOptionIdxSet(cfgOptType, 0, cfgSourceParam, VARSTRDEF("standby")), "set type");
|
||||||
|
TEST_RESULT_UINT(cfgOptionIdxStrId(cfgOptType, 0), STRID5("standby", 0x6444706930), "check type");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("stanza options should not be loaded for commands that don't take a stanza");
|
TEST_TITLE("stanza options should not be loaded for commands that don't take a stanza");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user