Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/sample_xconfwebconfig.conf
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ xconfwebconfig {
account_service_mac_prefix = "" // MAC prefix for account service
enable_tagging_service_rfc = false // Enable tagging service for RFC
enable_tagging_comparison = false // Enable COAST vs XConf tagging comparison logging
enable_account_tagging_override = true
enable_fw_download_logs = true // Enable firmware download logs
enable_rfc_precook = false // Enable RFC precook feature
enable_rfc_precook_304 = false // Enable RFC precook 304 status
Expand Down
7 changes: 7 additions & 0 deletions dataapi/dataapi_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ func AddGroupServiceFeatureTags(ws *xhttp.XconfServer, groupName string, context
for key, value := range featureTags {
if keyWithoutPrefix, ok := RemovePrefix(key, prefixList); ok {
if getPrefixData {
if Xc.EnableAccountTaggingOverride && strings.HasPrefix(keyWithoutPrefix, "accounttype:") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we avoid needing a code change for this by just adding the account type as a normal tag? Like "t_accountType" as the key and "business" or "residential" as the value. This will automatically be picked up as a tag with the HasPrefix method and will be added to the contextMap which will overwrite whatever value might already be there for "accountType".

if accountType, ok := contextMap["accountType"]; ok && accountType != "" {
delete(contextMap, common.ACCOUNT_TYPE)
}
log.WithFields(fields).Debugf("Overriding ACCOUNT_TYPE with value from GroupService tag: %s", keyWithoutPrefix)
}

contextMap[keyWithoutPrefix] = value
tags = append(tags, fmt.Sprintf("%s#%s", keyWithoutPrefix, value))
}
Expand Down
2 changes: 2 additions & 0 deletions dataapi/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type XconfConfigs struct {
ValidPartnerIdRegex *regexp.Regexp
SecurityTokenManagerEnabled bool
EnableTaggingComparison bool
EnableAccountTaggingOverride bool
}

// Function to register the table name and the corresponding model/struct constructor
Expand Down Expand Up @@ -340,6 +341,7 @@ func GetXconfConfigs(conf *conf.Config) *XconfConfigs {
PartnerIdValidationEnabled: partnerIdValidationEnabled,
SecurityTokenManagerEnabled: conf.GetBoolean("xconfwebconfig.xconf.security_token_manager_enabled"),
EnableTaggingComparison: conf.GetBoolean("xconfwebconfig.xconf.enable_tagging_comparison"),
EnableAccountTaggingOverride: conf.GetBoolean("xconfwebconfig.xconf.enable_account_tagging_override"),
}
return xc
}
Expand Down
Loading