mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 17:37:13 +02:00
Move more configuration options into YAML config files
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145452311
This commit is contained in:
parent
124011a8ce
commit
6c11ac5392
9 changed files with 91 additions and 38 deletions
|
@ -86,7 +86,7 @@ public final class RegistryConfig {
|
||||||
@Provides
|
@Provides
|
||||||
@Config("projectId")
|
@Config("projectId")
|
||||||
public static String provideProjectId(RegistryConfigSettings config) {
|
public static String provideProjectId(RegistryConfigSettings config) {
|
||||||
return config.general.appEngineProjectId;
|
return config.appEngine.projectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,15 +96,8 @@ public final class RegistryConfig {
|
||||||
*/
|
*/
|
||||||
@Provides
|
@Provides
|
||||||
@Config("logoFilename")
|
@Config("logoFilename")
|
||||||
public static String provideLogoFilename(RegistryEnvironment environment) {
|
public static String provideLogoFilename(RegistryConfigSettings config) {
|
||||||
switch (environment) {
|
return config.registrarConsole.logoFilename;
|
||||||
case UNITTEST:
|
|
||||||
case LOCAL:
|
|
||||||
return "logo.png";
|
|
||||||
default:
|
|
||||||
// Change this to the filename of your logo.
|
|
||||||
return "google_registry.png";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,9 +107,8 @@ public final class RegistryConfig {
|
||||||
*/
|
*/
|
||||||
@Provides
|
@Provides
|
||||||
@Config("productName")
|
@Config("productName")
|
||||||
public static String provideProductName(RegistryEnvironment environment) {
|
public static String provideProductName(RegistryConfigSettings config) {
|
||||||
// Change this to the name of your product.
|
return config.registryPolicy.productName;
|
||||||
return "Nomulus";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,8 +120,8 @@ public final class RegistryConfig {
|
||||||
*/
|
*/
|
||||||
@Provides
|
@Provides
|
||||||
@Config("contactAndHostRoidSuffix")
|
@Config("contactAndHostRoidSuffix")
|
||||||
public static String provideContactAndHostRoidSuffix(RegistryEnvironment environment) {
|
public static String provideContactAndHostRoidSuffix(RegistryConfigSettings config) {
|
||||||
return LocalTestConfig.CONTACT_AND_HOST_ROID_SUFFIX;
|
return config.registryPolicy.contactAndHostRoidSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1120,7 +1112,7 @@ public final class RegistryConfig {
|
||||||
* Returns the App Engine project ID, which is based off the environment name.
|
* Returns the App Engine project ID, which is based off the environment name.
|
||||||
*/
|
*/
|
||||||
public static String getProjectId() {
|
public static String getProjectId() {
|
||||||
return CONFIG_SETTINGS.get().general.appEngineProjectId;
|
return CONFIG_SETTINGS.get().appEngine.projectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1262,6 +1254,11 @@ public final class RegistryConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the roid suffix to be used for the roids of all contacts and hosts. */
|
||||||
|
public static String getContactAndHostRoidSuffix() {
|
||||||
|
return CONFIG_SETTINGS.get().registryPolicy.contactAndHostRoidSuffix;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memoizes loading of the {@link RegistryConfigSettings} POJO.
|
* Memoizes loading of the {@link RegistryConfigSettings} POJO.
|
||||||
*
|
*
|
||||||
|
@ -1278,8 +1275,6 @@ public final class RegistryConfig {
|
||||||
/** Config values used for local and unit test environments. */
|
/** Config values used for local and unit test environments. */
|
||||||
public static class LocalTestConfig {
|
public static class LocalTestConfig {
|
||||||
|
|
||||||
public static final String CONTACT_AND_HOST_ROID_SUFFIX = "ROID";
|
|
||||||
|
|
||||||
public static final String RESERVED_TERMS_TEST_EXPORT_DISCLAIMER = "This is a disclaimer.\n";
|
public static final String RESERVED_TERMS_TEST_EXPORT_DISCLAIMER = "This is a disclaimer.\n";
|
||||||
|
|
||||||
public static final String GOOGLE_APPS_SEND_FROM_EMAIL_ADDRESS = "noreply@testing.example";
|
public static final String GOOGLE_APPS_SEND_FROM_EMAIL_ADDRESS = "noreply@testing.example";
|
||||||
|
|
|
@ -17,16 +17,28 @@ package google.registry.config;
|
||||||
/** The POJO that YAML config files are deserialized into. */
|
/** The POJO that YAML config files are deserialized into. */
|
||||||
public class RegistryConfigSettings {
|
public class RegistryConfigSettings {
|
||||||
|
|
||||||
public General general;
|
public AppEngine appEngine;
|
||||||
|
|
||||||
|
public RegistryPolicy registryPolicy;
|
||||||
|
|
||||||
public Datastore datastore;
|
public Datastore datastore;
|
||||||
|
|
||||||
|
public RegistrarConsole registrarConsole;
|
||||||
|
|
||||||
public Monitoring monitoring;
|
public Monitoring monitoring;
|
||||||
|
|
||||||
/** General configuration options that apply to the entire App Engine project. */
|
/** Configuration options that apply to the entire App Engine project. */
|
||||||
public static class General {
|
public static class AppEngine {
|
||||||
|
|
||||||
public String appEngineProjectId;
|
public String projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configuration options for registry policy. */
|
||||||
|
public static class RegistryPolicy {
|
||||||
|
|
||||||
|
public String contactAndHostRoidSuffix;
|
||||||
|
|
||||||
|
public String productName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Configuration for Cloud Datastore. */
|
/** Configuration for Cloud Datastore. */
|
||||||
|
@ -37,6 +49,12 @@ public class RegistryConfigSettings {
|
||||||
public int eppResourceIndexBucketsNum;
|
public int eppResourceIndexBucketsNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Configuration for the web-based registrar console. */
|
||||||
|
public static class RegistrarConsole {
|
||||||
|
|
||||||
|
public String logoFilename;
|
||||||
|
}
|
||||||
|
|
||||||
/** Configuration for monitoring. */
|
/** Configuration for monitoring. */
|
||||||
public static class Monitoring {
|
public static class Monitoring {
|
||||||
|
|
||||||
|
|
|
@ -3,19 +3,31 @@
|
||||||
# individual deployment or environment, create a nomulus-config.yaml file in the
|
# individual deployment or environment, create a nomulus-config.yaml file in the
|
||||||
# WEB-INF/ directory overriding only the values you wish to change.
|
# WEB-INF/ directory overriding only the values you wish to change.
|
||||||
|
|
||||||
general:
|
appEngine:
|
||||||
# Globally unique App Engine project ID
|
# Globally unique App Engine project ID
|
||||||
appEngineProjectId: domain-registry
|
projectId: domain-registry
|
||||||
|
|
||||||
|
registryPolicy:
|
||||||
|
# Repository identifier (ROID) suffix for contacts and hosts.
|
||||||
|
contactAndHostRoidSuffix: ROID
|
||||||
|
|
||||||
|
# Product name of the registry. Used throughout the registrar console.
|
||||||
|
productName: Nomulus
|
||||||
|
|
||||||
datastore:
|
datastore:
|
||||||
# The number of commit log buckets in Datastore. Don't change after initial
|
# Number of commit log buckets in Datastore. Don't change after initial
|
||||||
# install.
|
# install.
|
||||||
commitLogBucketsNum: 100
|
commitLogBucketsNum: 100
|
||||||
|
|
||||||
# The number of EPP resource index buckets in Datastore. Don’t change after
|
# Number of EPP resource index buckets in Datastore. Don’t change after
|
||||||
# initial install.
|
# initial install.
|
||||||
eppResourceIndexBucketsNum: 997
|
eppResourceIndexBucketsNum: 997
|
||||||
|
|
||||||
|
registrarConsole:
|
||||||
|
# Filename of the logo to use in the header of the console. This filename is
|
||||||
|
# relative to ui/assets/images/
|
||||||
|
logoFilename: logo.png
|
||||||
|
|
||||||
monitoring:
|
monitoring:
|
||||||
# Max queries per second for the Google Cloud Monitoring V3 (aka Stackdriver)
|
# Max queries per second for the Google Cloud Monitoring V3 (aka Stackdriver)
|
||||||
# API. The limit can be adjusted by contacting Cloud Support.
|
# API. The limit can be adjusted by contacting Cloud Support.
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
|
||||||
general:
|
appEngine:
|
||||||
appEngineProjectId: domain-registry-alpha
|
projectId: domain-registry-alpha
|
||||||
|
|
||||||
|
registryPolicy:
|
||||||
|
contactAndHostRoidSuffix: GOOGLE
|
||||||
|
productName: Google Registry Alpha
|
||||||
|
|
||||||
|
registrarConsole:
|
||||||
|
logoFilename: google_registry.png
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
|
||||||
general:
|
appEngine:
|
||||||
appEngineProjectId: domain-registry-crash
|
projectId: domain-registry-crash
|
||||||
|
|
||||||
|
registryPolicy:
|
||||||
|
contactAndHostRoidSuffix: GOOGLE
|
||||||
|
productName: Google Registry Crash
|
||||||
|
|
||||||
|
registrarConsole:
|
||||||
|
logoFilename: google_registry.png
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
|
|
||||||
general:
|
appEngine:
|
||||||
appEngineProjectId: domain-registry
|
projectId: domain-registry
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
|
||||||
general:
|
appEngine:
|
||||||
appEngineProjectId: domain-registry
|
projectId: domain-registry
|
||||||
|
|
||||||
|
registryPolicy:
|
||||||
|
contactAndHostRoidSuffix: GOOGLE
|
||||||
|
productName: Google Registry
|
||||||
|
|
||||||
|
registrarConsole:
|
||||||
|
logoFilename: google_registry.png
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
|
||||||
general:
|
appEngine:
|
||||||
appEngineProjectId: domain-registry-sandbox
|
projectId: domain-registry-sandbox
|
||||||
|
|
||||||
|
registryPolicy:
|
||||||
|
contactAndHostRoidSuffix: GOOGLE
|
||||||
|
productName: Google Registry Sandbox
|
||||||
|
|
||||||
|
registrarConsole:
|
||||||
|
logoFilename: google_registry.png
|
||||||
|
|
|
@ -20,8 +20,8 @@ import static com.google.common.base.Suppliers.memoize;
|
||||||
import static com.google.common.collect.Iterables.toArray;
|
import static com.google.common.collect.Iterables.toArray;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assertWithMessage;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
import static google.registry.config.RegistryConfig.LocalTestConfig.CONTACT_AND_HOST_ROID_SUFFIX;
|
|
||||||
import static google.registry.config.RegistryConfig.LocalTestConfig.CONTACT_AUTOMATIC_TRANSFER_LENGTH;
|
import static google.registry.config.RegistryConfig.LocalTestConfig.CONTACT_AUTOMATIC_TRANSFER_LENGTH;
|
||||||
|
import static google.registry.config.RegistryConfig.getContactAndHostRoidSuffix;
|
||||||
import static google.registry.flows.ResourceFlowUtils.createTransferResponse;
|
import static google.registry.flows.ResourceFlowUtils.createTransferResponse;
|
||||||
import static google.registry.model.EppResourceUtils.createDomainRepoId;
|
import static google.registry.model.EppResourceUtils.createDomainRepoId;
|
||||||
import static google.registry.model.EppResourceUtils.createRepoId;
|
import static google.registry.model.EppResourceUtils.createRepoId;
|
||||||
|
@ -747,7 +747,7 @@ public class DatastoreHelper {
|
||||||
* HEX_TLD-ROID.
|
* HEX_TLD-ROID.
|
||||||
*/
|
*/
|
||||||
public static String generateNewContactHostRoid() {
|
public static String generateNewContactHostRoid() {
|
||||||
return createRepoId(ObjectifyService.allocateId(), CONTACT_AND_HOST_ROID_SUFFIX);
|
return createRepoId(ObjectifyService.allocateId(), getContactAndHostRoidSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue