mirror of
https://github.com/google/nomulus.git
synced 2025-07-21 10:16:07 +02:00
Add a method to test if Nomulus is running on Jetty (#2382)
This commit is contained in:
parent
e7bf74d91d
commit
3fdecde6e9
2 changed files with 19 additions and 2 deletions
|
@ -4,4 +4,8 @@
|
|||
<Configure id="wac" class="org.eclipse.jetty.ee10.webapp.WebAppContext">
|
||||
<Set name="contextPath">/</Set>
|
||||
<Set name="war">./webapps/nomulus.war</Set>
|
||||
<Call class="java.lang.System" name="setProperty">
|
||||
<Arg>google.registry.jetty</Arg>
|
||||
<Arg>true</Arg>
|
||||
</Call>
|
||||
</Configure>
|
||||
|
|
|
@ -47,6 +47,18 @@ public enum RegistryEnvironment {
|
|||
*/
|
||||
UNITTEST;
|
||||
|
||||
/** System property for configuring which environment we should use. */
|
||||
private static final String PROPERTY = "google.registry.environment";
|
||||
|
||||
/**
|
||||
* System property for if Nomulus is running on top of a self-hosted Jetty server (i.e., not in
|
||||
* App Engine).
|
||||
*/
|
||||
private static final String JETTY_PROPERTY = "google.registry.jetty";
|
||||
|
||||
private static final boolean ON_JETTY =
|
||||
Boolean.parseBoolean(System.getProperty(JETTY_PROPERTY, "false"));
|
||||
|
||||
/** Sets this enum as the name of the registry environment. */
|
||||
public RegistryEnvironment setup() {
|
||||
return setup(SystemPropertySetter.PRODUCTION_IMPL);
|
||||
|
@ -66,6 +78,7 @@ public enum RegistryEnvironment {
|
|||
return valueOf(Ascii.toUpperCase(System.getProperty(PROPERTY, UNITTEST.name())));
|
||||
}
|
||||
|
||||
/** System property for configuring which environment we should use. */
|
||||
private static final String PROPERTY = "google.registry.environment";
|
||||
public static boolean isOnJetty() {
|
||||
return ON_JETTY;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue