System property loader for RegistryConfig

This change allows registries to customize the values returned by
RegistryConfig methods without needing to edit Domain Registry code in a
forked repository. This is accomplished by defining a custom
RegistryConfig implementation and specifying its name as a system
property in appengine-web.xml.

This change also open-sources the production configuration values that
Google has chosen to use for these methods. TestRegistryConfig was
hitherto used for production configuration in the open source world,
which is misleading and inappropriate, considering it tunes values such
as the number of commit log buckets to 1.

Another important benefit of this change is that it helps registry_tool
work out of the box in the open source world.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129022675
This commit is contained in:
Justine Tunney 2016-08-01 13:52:34 -07:00
parent e3bb5dc9b0
commit 3f471a32e2
5 changed files with 317 additions and 5 deletions

View file

@ -79,11 +79,8 @@ public enum RegistryEnvironment {
@Nullable
private static RegistryConfig configOverride;
// TODO(b/19247780) Use true dependency injection for this. In the mean time, if you're not
// Google, you'll need to change this to include your own config class implementation at compile
// time.
private static final RegistryConfig testingConfig = new TestRegistryConfig();
private final RegistryConfig config = new TestRegistryConfig();
private final RegistryConfig config = RegistryConfigLoader.load(this);
/** System property for configuring which environment we should use. */
public static final String PROPERTY = "google.registry.environment";