aboutsummaryrefslogtreecommitdiffstats
path: root/yt/yt/library/tvm/service/config.cpp
blob: f1671e86500c9d96aebee1b4b84661ebcd294761 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "config.h"

namespace NYT::NAuth {

////////////////////////////////////////////////////////////////////////////////

void TTvmServiceConfig::Register(TRegistrar registrar)
{
    registrar.Parameter("use_tvm_tool", &TThis::UseTvmTool)
        .Default(false);
    registrar.Parameter("client_self_id", &TThis::ClientSelfId)
        .Default(0);
    registrar.Parameter("client_disk_cache_dir", &TThis::ClientDiskCacheDir)
        .Optional();
    registrar.Parameter("tvm_host", &TThis::TvmHost)
        .Optional();
    registrar.Parameter("tvm_port", &TThis::TvmPort)
        .Optional();
    registrar.Parameter("client_enable_user_ticket_checking", &TThis::ClientEnableUserTicketChecking)
        .Default(false);
    registrar.Parameter("client_blackbox_env", &TThis::ClientBlackboxEnv)
        .Default("ProdYateam");
    registrar.Parameter("client_enable_service_ticket_fetching", &TThis::ClientEnableServiceTicketFetching)
        .Default(false);
    registrar.Parameter("client_self_secret", &TThis::ClientSelfSecret)
        .Optional();
    registrar.Parameter("client_self_secret_path", &TThis::ClientSelfSecretPath)
        .Optional();
    registrar.Parameter("client_self_secret_env", &TThis::ClientSelfSecretEnv)
        .Optional();
    registrar.Parameter("client_dst_map", &TThis::ClientDstMap)
        .Optional();
    registrar.Parameter("client_enable_service_ticket_checking", &TThis::ClientEnableServiceTicketChecking)
        .Default(false);

    registrar.Parameter("enable_ticket_parse_cache", &TThis::EnableTicketParseCache)
        .Default(false);
    registrar.Parameter("ticket_checking_cache_timeout", &TThis::TicketCheckingCacheTimeout)
        .Default(TDuration::Minutes(1));

    registrar.Parameter("tvm_tool_self_alias", &TThis::TvmToolSelfAlias)
        .Optional();
    registrar.Parameter("tvm_tool_port", &TThis::TvmToolPort)
        .Optional();
    registrar.Parameter("tvm_tool_auth_token", &TThis::TvmToolAuthToken)
        .Optional();

    registrar.Parameter("enable_mock", &TThis::EnableMock)
        .Default(false);
    registrar.Parameter("require_mock_secret", &TThis::RequireMockSecret)
        .Default(true);

    registrar.Postprocessor([] (TThis* config) {
        if (config->ClientSelfSecretEnv && config->ClientSelfSecretPath) {
            THROW_ERROR_EXCEPTION("Options \"client_self_secret_env\", \"client_self_secret_path\" "
                "cannot be used together");
        }
    });
}

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT::NAuth