Add gift configuration source

This commit is contained in:
Ehren Kret 2022-04-27 11:44:49 -05:00
parent f21e9bcc4d
commit f6471cf8f9
2 changed files with 31 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import org.whispersystems.textsecuregcm.configuration.DynamoDbClientConfiguratio
import org.whispersystems.textsecuregcm.configuration.DynamoDbTables;
import org.whispersystems.textsecuregcm.configuration.GcmConfiguration;
import org.whispersystems.textsecuregcm.configuration.GcpAttachmentsConfiguration;
import org.whispersystems.textsecuregcm.configuration.GiftConfiguration;
import org.whispersystems.textsecuregcm.configuration.MaxDeviceConfiguration;
import org.whispersystems.textsecuregcm.configuration.MessageCacheConfiguration;
import org.whispersystems.textsecuregcm.configuration.PaymentsServiceConfiguration;
@ -242,6 +243,11 @@ public class WhisperServerConfiguration extends Configuration {
@NotNull
private BoostConfiguration boost;
@Valid
@JsonProperty
@NotNull
private GiftConfiguration gift;
@Valid
@NotNull
@JsonProperty
@ -417,6 +423,10 @@ public class WhisperServerConfiguration extends Configuration {
return boost;
}
public GiftConfiguration getGift() {
return gift;
}
public ReportMessageConfiguration getReportMessageConfiguration() {
return reportMessage;
}

View File

@ -0,0 +1,21 @@
/*
* Copyright 2022 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.configuration;
import java.math.BigDecimal;
import java.time.Duration;
import java.util.Map;
import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
public record GiftConfiguration(
long level,
@NotNull Duration expiration,
@Valid @NotNull Map<@NotEmpty String, @DecimalMin("0.01") @NotNull BigDecimal> currencies,
@NotEmpty String badge) {
}