mirror of
https://github.com/google/nomulus
synced 2026-01-04 12:14:19 +00:00
Make Cloud Tasks Utils canary-aware (#2639)
This commit is contained in:
@@ -58,9 +58,15 @@ public enum RegistryEnvironment {
|
||||
*/
|
||||
private static final String JETTY_PROPERTY = "google.registry.jetty";
|
||||
|
||||
/** Name of the environmental variable of the container name. */
|
||||
private static final String CONTAINER_ENV = "CONTAINER_NAME";
|
||||
|
||||
private static final boolean ON_JETTY =
|
||||
Boolean.parseBoolean(System.getProperty(JETTY_PROPERTY, "false"));
|
||||
|
||||
private static final boolean IS_CANARY =
|
||||
System.getenv().getOrDefault(CONTAINER_ENV, "").endsWith("-canary");
|
||||
|
||||
/**
|
||||
* A thread local boolean that can be set in tests to indicate some code is running in a local
|
||||
* test server.
|
||||
@@ -98,6 +104,10 @@ public enum RegistryEnvironment {
|
||||
return ON_JETTY;
|
||||
}
|
||||
|
||||
public static boolean isCanary() {
|
||||
return IS_CANARY;
|
||||
}
|
||||
|
||||
public static void setIsInTestDriver(boolean value) {
|
||||
checkState(RegistryEnvironment.get() == RegistryEnvironment.UNITTEST);
|
||||
IN_TEST_SERVER.set(value);
|
||||
|
||||
Reference in New Issue
Block a user