Add SIGNAL_SERVER_CONFIG override to LocalWhisperServerService

This commit is contained in:
Chris Eager 2024-05-23 10:44:09 -05:00 committed by Chris Eager
parent e59a1e9efd
commit 7286e724dc
1 changed files with 10 additions and 1 deletions

View File

@ -6,6 +6,7 @@
package org.whispersystems.textsecuregcm;
import io.dropwizard.util.Resources;
import java.util.Optional;
/**
* This class may be run directly from a correctly configured IDE, or using the command line:
@ -13,9 +14,14 @@ import io.dropwizard.util.Resources;
* <code>./mvnw clean integration-test -DskipTests=true -Ptest-server</code>
* <p>
* <strong>NOTE: many features are non-functional, especially those that depend on external services</strong>
* <p>
* By default, it will use {@code config/test.yml}, but this may be overridden by setting an environment variable,
* {@value SIGNAL_SERVER_CONFIG_ENV_VAR}, with a custom path.
*/
public class LocalWhisperServerService {
private static final String SIGNAL_SERVER_CONFIG_ENV_VAR = "SIGNAL_SERVER_CONFIG";
public static void main(String[] args) throws Exception {
System.setProperty("secrets.bundle.filename",
@ -23,6 +29,9 @@ public class LocalWhisperServerService {
System.setProperty("sqlite.dir", "service/target/lib");
System.setProperty("aws.region", "local-test-region");
new WhisperServerService().run("server", Resources.getResource("config/test.yml").getPath());
final String config = Optional.ofNullable(System.getenv(SIGNAL_SERVER_CONFIG_ENV_VAR))
.orElse(Resources.getResource("config/test.yml").getPath());
new WhisperServerService().run("server", config);
}
}