Create configuration for badges
This commit is contained in:
parent
6ee23b0186
commit
aa1c37fe26
|
@ -233,3 +233,8 @@ donation:
|
||||||
retry:
|
retry:
|
||||||
maxAttempts: # value
|
maxAttempts: # value
|
||||||
waitDuration: # value
|
waitDuration: # value
|
||||||
|
|
||||||
|
badges:
|
||||||
|
badges:
|
||||||
|
- name: TEST
|
||||||
|
imageUrl: https://example.com/test-badge
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.whispersystems.textsecuregcm.configuration.AccountsDynamoDbConfigurat
|
||||||
import org.whispersystems.textsecuregcm.configuration.ApnConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.ApnConfiguration;
|
||||||
import org.whispersystems.textsecuregcm.configuration.AppConfigConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.AppConfigConfiguration;
|
||||||
import org.whispersystems.textsecuregcm.configuration.AwsAttachmentsConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.AwsAttachmentsConfiguration;
|
||||||
|
import org.whispersystems.textsecuregcm.configuration.BadgesConfiguration;
|
||||||
import org.whispersystems.textsecuregcm.configuration.CdnConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.CdnConfiguration;
|
||||||
import org.whispersystems.textsecuregcm.configuration.DatabaseConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.DatabaseConfiguration;
|
||||||
import org.whispersystems.textsecuregcm.configuration.DatadogConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.DatadogConfiguration;
|
||||||
|
@ -298,6 +299,11 @@ public class WhisperServerConfiguration extends Configuration {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private DonationConfiguration donation;
|
private DonationConfiguration donation;
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
@NotNull
|
||||||
|
@JsonProperty
|
||||||
|
private BadgesConfiguration badges;
|
||||||
|
|
||||||
private Map<String, String> transparentDataIndex = new HashMap<>();
|
private Map<String, String> transparentDataIndex = new HashMap<>();
|
||||||
|
|
||||||
public RecaptchaConfiguration getRecaptchaConfiguration() {
|
public RecaptchaConfiguration getRecaptchaConfiguration() {
|
||||||
|
@ -513,4 +519,8 @@ public class WhisperServerConfiguration extends Configuration {
|
||||||
public DonationConfiguration getDonationConfiguration() {
|
public DonationConfiguration getDonationConfiguration() {
|
||||||
return donation;
|
return donation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BadgesConfiguration getBadges() {
|
||||||
|
return badges;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2021 Signal Messenger, LLC
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.whispersystems.textsecuregcm.configuration;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
public class BadgeConfiguration {
|
||||||
|
private final String name;
|
||||||
|
private final String imageUrl;
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public BadgeConfiguration(
|
||||||
|
@JsonProperty("name") final String name,
|
||||||
|
@JsonProperty("imageUrl") final String imageUrl) {
|
||||||
|
this.name = name;
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotEmpty
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotEmpty
|
||||||
|
public String getImageUrl() {
|
||||||
|
return imageUrl;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2021 Signal Messenger, LLC
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.whispersystems.textsecuregcm.configuration;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
|
import com.fasterxml.jackson.annotation.Nulls;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public class BadgesConfiguration {
|
||||||
|
private final List<BadgeConfiguration> badges;
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public BadgesConfiguration(
|
||||||
|
@JsonProperty("badges") @JsonSetter(nulls = Nulls.AS_EMPTY) final List<BadgeConfiguration> badges) {
|
||||||
|
this.badges = Objects.requireNonNull(badges);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
@NotNull
|
||||||
|
public List<BadgeConfiguration> getBadges() {
|
||||||
|
return badges;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue