aboutsummaryrefslogtreecommitdiffstats
path: root/yt/yt/library/tvm/service/config.h
blob: e9fededf27b1fdc92ec7c8f5dce5ad1912137577 (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
64
65
66
67
68
#pragma once

#include "public.h"

#include <yt/yt/core/ytree/yson_struct.h>

namespace NYT::NAuth {

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

struct TTvmServiceConfig
    : public virtual NYTree::TYsonStruct
{
    bool UseTvmTool;

    // TvmClient settings
    TTvmId ClientSelfId = 0;
    std::optional<TString> ClientDiskCacheDir;

    std::optional<TString> TvmHost;
    std::optional<ui16> TvmPort;

    bool ClientEnableUserTicketChecking = false;
    TString ClientBlackboxEnv;

    bool ClientEnableServiceTicketFetching = false;

    //! Do not use this option as the plaintext value of secret may be exposed via service orchid or somehow else.
    std::optional<TString> ClientSelfSecret;

    //! Name of env variable with TVM secret. Used if ClientSelfSecret is unset.
    std::optional<TString> ClientSelfSecretEnv;

    //! Path to TVM secret. Used if ClientSelfSecret is unset.
    std::optional<TString> ClientSelfSecretPath;

    THashMap<TString, TTvmId> ClientDstMap;

    bool ClientEnableServiceTicketChecking = false;

    //! If true, then checked tickets are cached, allowing us to speed up checking.
    bool EnableTicketParseCache = false;
    TDuration TicketCheckingCacheTimeout;

    TString TvmToolSelfAlias;
    //! If not specified, get port from env variable `DEPLOY_TVM_TOOL_URL`.
    int TvmToolPort = 0;
    //! Do not use this option in production.
    //! If not specified, get token from env variable `TVMTOOL_LOCAL_AUTHTOKEN`.
    std::optional<TString> TvmToolAuthToken;

    //! For testing only. If enabled, then a mock instead of a real TVM service will be used.
    bool EnableMock = false;

    //! If EnableMock and RequireMockSecret is true, then ensures that ClientSelfSecret is equal to
    //! "SecretPrefix-" + ToString(ClientSelfId).
    bool RequireMockSecret = true;

    REGISTER_YSON_STRUCT(TTvmServiceConfig);

    static void Register(TRegistrar registrar);
};

DEFINE_REFCOUNTED_TYPE(TTvmServiceConfig)

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

} // namespace NYT::NAuth