mirror of
https://github.com/google/nomulus
synced 2026-02-05 20:41:08 +00:00
Add ability to configure proxy quotas
The quotas can be configured in the yaml configuration file. Default quota will be applied to any userId that is not matched in the custom quota list. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=178804649
This commit is contained in:
@@ -61,6 +61,7 @@ public class ProxyConfig {
|
||||
public int headerLengthBytes;
|
||||
public int readTimeoutSeconds;
|
||||
public String serverHostname;
|
||||
public Quota quota;
|
||||
}
|
||||
|
||||
/** Configuration options that apply to WHOIS protocol. */
|
||||
@@ -70,6 +71,7 @@ public class ProxyConfig {
|
||||
public String relayPath;
|
||||
public int maxMessageLengthBytes;
|
||||
public int readTimeoutSeconds;
|
||||
public Quota quota;
|
||||
}
|
||||
|
||||
/** Configuration options that apply to GCP load balancer health check protocol. */
|
||||
@@ -92,6 +94,21 @@ public class ProxyConfig {
|
||||
public int writeIntervalSeconds;
|
||||
}
|
||||
|
||||
/** Configuration options that apply to quota management. */
|
||||
public static class Quota {
|
||||
|
||||
/** Quota configuration for a specific set of users. */
|
||||
public static class QuotaGroup {
|
||||
public List<String> userId;
|
||||
public int tokenAmount;
|
||||
public int refillSeconds;
|
||||
}
|
||||
|
||||
public int refreshSeconds;
|
||||
public QuotaGroup defaultQuota;
|
||||
public List<QuotaGroup> customQuota;
|
||||
}
|
||||
|
||||
static ProxyConfig getProxyConfig(Environment env) {
|
||||
String defaultYaml = readResourceUtf8(ProxyConfig.class, DEFAULT_CONFIG);
|
||||
String customYaml =
|
||||
|
||||
Reference in New Issue
Block a user