forked from planetarium/NineChronicles.Headless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configuration.cs
202 lines (182 loc) · 8.67 KB
/
Configuration.cs
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
using System;
using System.IO;
using Libplanet.Headless;
using Nekoyume;
using NineChronicles.Headless.Properties;
namespace NineChronicles.Headless.Executable
{
public class Configuration
{
public string? AppProtocolVersionString { get; set; }
public string[]? TrustedAppProtocolVersionSignerStrings { get; set; }
public string? GenesisBlockPath { get; set; }
public string? Host { get; set; }
public ushort? Port { get; set; }
public string? SwarmPrivateKeyString { get; set; }
// Storage
public string? StoreType { get; set; }
public string? StorePath { get; set; } =
Path.Combine(
new string[]
{
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
"AppData", "Local", "planetarium", "9c-main-partition"
}
);
public bool NoReduceStore { get; set; }
public int StoreStateCacheSize { get; set; } = 100;
// Miner
public bool NoMiner { get; set; }
public int MinerCount { get; set; } = 1;
public string? MinerPrivateKeyString { get; set; }
public int MinerBlockIntervalMilliseconds { get; set; }
public Planet Planet { get; set; } = Planet.Odin;
// Networking
public string[]? IceServerStrings { get; set; }
public string[]? PeerStrings { get; set; }
// RPC Server
public bool RpcServer { get; set; }
public string RpcListenHost { get; set; } = "0.0.0.0";
public int? RpcListenPort { get; set; }
public bool? RpcRemoteServer { get; set; }
public bool? RpcHttpServer { get; set; }
// RemoteKeyValueService
public bool RemoteKeyValueService { get; set; } = false;
// GraphQL Server
public bool GraphQLServer { get; set; }
public string? GraphQLHost { get; set; }
public int? GraphQLPort { get; set; }
public string? GraphQLSecretTokenPath { get; set; }
public bool NoCors { get; set; }
// Rendering
public bool NonblockRenderer { get; set; }
public int NonblockRendererQueue { get; set; } = 512;
public bool StrictRendering { get; set; }
public bool? LogActionRenders { get; set; }
// Settings
public int Confirmations { get; set; }
public int TxLifeTime { get; set; } = 1000;
public int MessageTimeout { get; set; } = 60;
public int TipTimeout { get; set; } = 60;
public int DemandBuffer { get; set; } = 1150;
public bool SkipPreload { get; set; }
public int MinimumBroadcastTarget { get; set; } = 10;
public int BucketSize { get; set; } = 16;
public string ChainTipStaleBehaviorType { get; set; } = "reboot";
public int TxQuotaPerSigner { get; set; } = 10;
public int MaximumPollPeers { get; set; } = int.MaxValue;
public ActionTypeLoaderConfiguration? ActionTypeLoader { get; set; } = null;
// Consensus
public string? ConsensusPrivateKeyString { get; set; }
public string[]? ConsensusSeedStrings { get; set; }
public ushort? ConsensusPort { get; set; }
public double? ConsensusTargetBlockIntervalMilliseconds { get; set; }
public int? ConsensusProposeSecondBase { get; set; }
public int? MaxTransactionPerBlock { get; set; }
public AccessControlServiceOptions? AccessControlService { get; set; }
public int ArenaParticipantsSyncInterval { get; set; } = 1000;
public void Overwrite(
string? appProtocolVersionString,
string[]? trustedAppProtocolVersionSignerStrings,
string? genesisBlockPath,
string? host,
ushort? port,
string? swarmPrivateKeyString,
string? storeType,
string? storePath,
bool? noReduceStore,
bool? noMiner,
int? minerCount,
string? minerPrivateKeyString,
int? minerBlockIntervalMilliseconds,
Planet? planet,
string[]? iceServerStrings,
string[]? peerStrings,
bool? rpcServer,
string? rpcListenHost,
int? rpcListenPort,
bool? rpcRemoteServer,
bool? rpcHttpServer,
bool? graphQlServer,
string? graphQLHost,
int? graphQLPort,
string? graphQlSecretTokenPath,
bool? noCors,
bool? nonblockRenderer,
int? nonblockRendererQueue,
bool? strictRendering,
bool? logActionRenders,
int? confirmations,
int? txLifeTime,
int? messageTimeout,
int? tipTimeout,
int? demandBuffer,
bool? skipPreload,
int? minimumBroadcastTarget,
int? bucketSize,
string? chainTipStaleBehaviorType,
int? txQuotaPerSigner,
int? maximumPollPeers,
ushort? consensusPort,
string? consensusPrivateKeyString,
string[]? consensusSeedStrings,
double? consensusTargetBlockIntervalMilliseconds,
int? consensusProposeSecondBase,
int? maxTransactionPerBlock,
int? arenaParticipantsSyncInterval,
bool? remoteKeyValueService
)
{
AppProtocolVersionString = appProtocolVersionString ?? AppProtocolVersionString;
TrustedAppProtocolVersionSignerStrings =
trustedAppProtocolVersionSignerStrings ?? TrustedAppProtocolVersionSignerStrings;
GenesisBlockPath = genesisBlockPath ?? GenesisBlockPath;
Host = host ?? Host;
Port = port ?? Port;
SwarmPrivateKeyString = swarmPrivateKeyString ?? SwarmPrivateKeyString;
StoreType = storeType ?? StoreType;
StorePath = storePath ?? StorePath;
NoReduceStore = noReduceStore ?? NoReduceStore;
NoMiner = noMiner ?? NoMiner;
MinerCount = minerCount ?? MinerCount;
MinerPrivateKeyString = minerPrivateKeyString ?? MinerPrivateKeyString;
MinerBlockIntervalMilliseconds = minerBlockIntervalMilliseconds ?? MinerBlockIntervalMilliseconds;
Planet = planet ?? Planet;
IceServerStrings = iceServerStrings ?? IceServerStrings;
PeerStrings = peerStrings ?? PeerStrings;
RpcServer = rpcServer ?? RpcServer;
RpcListenHost = rpcListenHost ?? RpcListenHost;
RpcListenPort = rpcListenPort ?? RpcListenPort;
RpcRemoteServer = rpcRemoteServer ?? RpcRemoteServer;
RpcHttpServer = rpcHttpServer ?? RpcHttpServer;
GraphQLServer = graphQlServer ?? GraphQLServer;
GraphQLHost = graphQLHost ?? GraphQLHost;
GraphQLPort = graphQLPort ?? GraphQLPort;
GraphQLSecretTokenPath = graphQlSecretTokenPath ?? GraphQLSecretTokenPath;
NoCors = noCors ?? NoCors;
NonblockRenderer = nonblockRenderer ?? NonblockRenderer;
NonblockRendererQueue = nonblockRendererQueue ?? NonblockRendererQueue;
StrictRendering = strictRendering ?? StrictRendering;
LogActionRenders = logActionRenders ?? LogActionRenders;
Confirmations = confirmations ?? Confirmations;
TxLifeTime = txLifeTime ?? TxLifeTime;
MessageTimeout = messageTimeout ?? MessageTimeout;
TipTimeout = tipTimeout ?? TipTimeout;
DemandBuffer = demandBuffer ?? DemandBuffer;
SkipPreload = skipPreload ?? SkipPreload;
MinimumBroadcastTarget = minimumBroadcastTarget ?? MinimumBroadcastTarget;
BucketSize = bucketSize ?? BucketSize;
ChainTipStaleBehaviorType = chainTipStaleBehaviorType ?? ChainTipStaleBehaviorType;
TxQuotaPerSigner = txQuotaPerSigner ?? TxQuotaPerSigner;
MaximumPollPeers = maximumPollPeers ?? MaximumPollPeers;
ConsensusPort = consensusPort ?? ConsensusPort;
ConsensusSeedStrings = consensusSeedStrings ?? ConsensusSeedStrings;
ConsensusPrivateKeyString = consensusPrivateKeyString ?? ConsensusPrivateKeyString;
ConsensusTargetBlockIntervalMilliseconds = consensusTargetBlockIntervalMilliseconds ?? ConsensusTargetBlockIntervalMilliseconds;
ConsensusProposeSecondBase = consensusProposeSecondBase ?? ConsensusProposeSecondBase;
MaxTransactionPerBlock = maxTransactionPerBlock ?? MaxTransactionPerBlock;
ArenaParticipantsSyncInterval = arenaParticipantsSyncInterval ?? ArenaParticipantsSyncInterval;
RemoteKeyValueService = remoteKeyValueService ?? RemoteKeyValueService;
}
}
}