mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Remove the old RegistryConfig paradigm entirely
We are now ready to begin configuration using YAML, mediated by ConfigModule. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143818507
This commit is contained in:
parent
c5c74961bb
commit
d3397e991e
17 changed files with 18 additions and 323 deletions
|
@ -14,9 +14,7 @@
|
|||
|
||||
package google.registry.config;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Ascii;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/** Registry environments. */
|
||||
public enum RegistryEnvironment {
|
||||
|
@ -54,39 +52,6 @@ public enum RegistryEnvironment {
|
|||
return valueOf(Ascii.toUpperCase(System.getProperty(PROPERTY, UNITTEST.name())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns configuration for this registry environment.
|
||||
*
|
||||
* <p><b>WARNING:</b> Do not store this value to a static field, otherwise you won't be able to
|
||||
* override it for testing. You should instead store the environment object to a static field.
|
||||
*/
|
||||
public RegistryConfig config() {
|
||||
if (configOverride != null) {
|
||||
return configOverride;
|
||||
} else if (this == UNITTEST) {
|
||||
return testingConfig;
|
||||
} else {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
/** Globally override registry configuration from within a unit test. */
|
||||
@VisibleForTesting
|
||||
@Deprecated
|
||||
public static void overrideConfigurationForTesting(@Nullable RegistryConfig newConfig) {
|
||||
configOverride = newConfig;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Deprecated
|
||||
private static RegistryConfig configOverride;
|
||||
|
||||
@Deprecated
|
||||
private static final RegistryConfig testingConfig = new TestRegistryConfig();
|
||||
|
||||
@Deprecated
|
||||
private final RegistryConfig config = RegistryConfigLoader.load(this);
|
||||
|
||||
/** System property for configuring which environment we should use. */
|
||||
public static final String PROPERTY = "google.registry.environment";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue