ED-124: -drop legacy ContextTokens (#35)

This commit is contained in:
dinama 2021-09-09 19:52:45 +03:00 committed by GitHub
parent 6dbd5079a7
commit 90f64bb523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 24 deletions

View File

@ -2,7 +2,7 @@
[{<<"bear">>,{pkg,<<"bear">>,<<"0.9.0">>},2},
{<<"bouncer_proto">>,
{git,"git@github.com:rbkmoney/bouncer-proto.git",
{ref,"8da12fe98bc751e7f8f17f64ad4f571a6a63b0fe"}},
{ref,"cc50cc4549ce4598a023dea5b1ab0a25a449a2d0"}},
0},
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},1},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.6.1">>},2},

View File

@ -61,29 +61,10 @@ from_thrift_context(Ctx) ->
-spec try_upgrade(thrift_ctx_fragment()) -> thrift_ctx_fragment().
try_upgrade(#bctx_v1_ContextFragment{vsn = 1} = Ctx) ->
% TODO #ED-124 #ED-162 rbkmoney/bouncer-policies#46
% tokens.replacement_ip -> client_info.ip
% удалить после выкатки capi_pcidss|bouncer-proto без bctx_v1_ContextTokens
ContextCAPI =
case Ctx#bctx_v1_ContextFragment.tokens of
#bctx_v1_ContextTokens{replacement_ip = undefined} ->
Ctx#bctx_v1_ContextFragment.capi;
#bctx_v1_ContextTokens{replacement_ip = IP} ->
CAPI = Ctx#bctx_v1_ContextFragment.capi,
Operation = CAPI#bctx_v1_ContextCommonAPI.op,
ClientInfo = #bctx_v1_ClientInfo{ip = IP},
CAPI#bctx_v1_ContextCommonAPI{
op = Operation#bctx_v1_CommonAPIOperation{
client_info = ClientInfo
}
};
_ ->
Ctx#bctx_v1_ContextFragment.capi
end,
Ctx#bctx_v1_ContextFragment{
vsn = ?BCTX_V1_HEAD,
capi = ContextCAPI
};
% no legacy data producers
% legacy structures have been removed
% nothing to update
Ctx#bctx_v1_ContextFragment{vsn = ?BCTX_V1_HEAD};
try_upgrade(#bctx_v1_ContextFragment{vsn = ?BCTX_V1_HEAD} = Ctx) ->
Ctx.