diff --git a/service/config/sample.yml b/service/config/sample.yml index dee867d48..361270c78 100644 --- a/service/config/sample.yml +++ b/service/config/sample.yml @@ -1,3 +1,5 @@ +environment: # value + twilio: # Twilio gateway configuration accountId: accountToken: diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java index f9e81a1d3..0d79d25bd 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java @@ -12,6 +12,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import org.whispersystems.textsecuregcm.configuration.AccountDatabaseCrawlerConfiguration; import org.whispersystems.textsecuregcm.configuration.AccountsDatabaseConfiguration; @@ -51,6 +52,10 @@ import org.whispersystems.websocket.configuration.WebSocketConfiguration; /** @noinspection MismatchedQueryAndUpdateOfCollection, WeakerAccess */ public class WhisperServerConfiguration extends Configuration { + @NotEmpty + @JsonProperty + private String environment; + @NotNull @Valid @JsonProperty @@ -258,6 +263,10 @@ public class WhisperServerConfiguration extends Configuration { private Map transparentDataIndex = new HashMap<>(); + public String getEnvironment() { + return environment; + } + public RecaptchaConfiguration getRecaptchaConfiguration() { return recaptcha; } diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java index 455e3511b..ec8712029 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java @@ -43,6 +43,8 @@ import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.distribution.DistributionStatisticConfig; import io.micrometer.wavefront.WavefrontConfig; import io.micrometer.wavefront.WavefrontMeterRegistry; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.net.http.HttpClient; import java.time.Duration; import java.util.ArrayList; @@ -65,6 +67,7 @@ import org.jdbi.v3.core.Jdbi; import org.signal.zkgroup.ServerSecretParams; import org.signal.zkgroup.auth.ServerZkAuthOperations; import org.signal.zkgroup.profiles.ServerZkProfileOperations; +import org.slf4j.MDC; import org.whispersystems.dispatch.DispatchManager; import org.whispersystems.textsecuregcm.auth.AccountAuthenticator; import org.whispersystems.textsecuregcm.auth.CertificateGenerator; @@ -226,8 +229,15 @@ public class WhisperServerService extends Application