mirror of
https://github.com/google/nomulus.git
synced 2025-07-19 17:26:09 +02:00
Move registry policy settings and some others into YAML config
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145571850
This commit is contained in:
parent
efedc03d45
commit
f647ea1190
15 changed files with 131 additions and 109 deletions
|
@ -20,7 +20,6 @@ import static google.registry.config.YamlUtils.getConfigSettings;
|
|||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import static org.joda.time.Duration.standardDays;
|
||||
|
||||
import com.google.appengine.api.utils.SystemProperty;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -132,9 +131,8 @@ public final class RegistryConfig {
|
|||
*/
|
||||
@Provides
|
||||
@Config("integrationEmail")
|
||||
public static String provideIntegrationEmail(RegistryEnvironment environment) {
|
||||
// Change this to your integration email address.
|
||||
return "integration@example.com";
|
||||
public static String provideIntegrationEmail(RegistryConfigSettings config) {
|
||||
return config.registrarConsole.integrationEmailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,9 +143,8 @@ public final class RegistryConfig {
|
|||
*/
|
||||
@Provides
|
||||
@Config("supportEmail")
|
||||
public static String provideSupportEmail(RegistryEnvironment environment) {
|
||||
// Change this to your support email address.
|
||||
return "support@example.com";
|
||||
public static String provideSupportEmail(RegistryConfigSettings config) {
|
||||
return config.registrarConsole.supportEmailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,9 +155,8 @@ public final class RegistryConfig {
|
|||
*/
|
||||
@Provides
|
||||
@Config("announcementsEmail")
|
||||
public static String provideAnnouncementsEmail(RegistryEnvironment environment) {
|
||||
// Change this to your announcements e-mail.
|
||||
return "announcements@example.com";
|
||||
public static String provideAnnouncementsEmail(RegistryConfigSettings config) {
|
||||
return config.registrarConsole.announcementsEmailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,9 +166,8 @@ public final class RegistryConfig {
|
|||
*/
|
||||
@Provides
|
||||
@Config("supportPhoneNumber")
|
||||
public static String provideSupportPhoneNumber(RegistryEnvironment environment) {
|
||||
// Change this to your phone number.
|
||||
return "+1 (888) 555 0123";
|
||||
public static String provideSupportPhoneNumber(RegistryConfigSettings config) {
|
||||
return config.registrarConsole.supportPhoneNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,9 +178,8 @@ public final class RegistryConfig {
|
|||
*/
|
||||
@Provides
|
||||
@Config("technicalDocsUrl")
|
||||
public static String provideTechnicalDocsUrl(RegistryEnvironment environment) {
|
||||
// Change this to your support docs link.
|
||||
return "http://example.com/your_support_docs/";
|
||||
public static String provideTechnicalDocsUrl(RegistryConfigSettings config) {
|
||||
return config.registrarConsole.technicalDocsUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -372,15 +366,15 @@ public final class RegistryConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the email address of the admin account for the Google App.
|
||||
* Returns the email address of the admin account on the G Suite app used to perform
|
||||
* administrative actions.
|
||||
*
|
||||
* @see google.registry.groups.DirectoryGroupsConnection
|
||||
*/
|
||||
@Provides
|
||||
@Config("googleAppsAdminEmailAddress")
|
||||
public static String provideGoogleAppsAdminEmailAddress(RegistryEnvironment environment) {
|
||||
// Change this to your admin account.
|
||||
return "admin@example.com";
|
||||
@Config("gSuiteAdminAccountEmailAddress")
|
||||
public static String provideGSuiteAdminAccountEmailAddress(RegistryConfigSettings config) {
|
||||
return config.gSuite.adminAccountEmailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -392,29 +386,20 @@ public final class RegistryConfig {
|
|||
@Provides
|
||||
@Config("registrarChangesNotificationEmailAddresses")
|
||||
public static ImmutableList<String> provideRegistrarChangesNotificationEmailAddresses(
|
||||
RegistryEnvironment environment) {
|
||||
switch (environment) {
|
||||
case PRODUCTION:
|
||||
// Change this to an appropriate notification e-mail address.
|
||||
return ImmutableList.of("notification@registry.example");
|
||||
case UNITTEST:
|
||||
return ImmutableList.of("notification@test.example", "notification2@test.example");
|
||||
default:
|
||||
return ImmutableList.<String>of();
|
||||
}
|
||||
RegistryConfigSettings config) {
|
||||
return ImmutableList.copyOf(config.registryPolicy.registrarChangesNotificationEmailAddresses);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the publicly accessible domain name for the running Google Apps instance.
|
||||
* Returns the publicly accessible domain name for the running G Suite instance.
|
||||
*
|
||||
* @see google.registry.export.SyncGroupMembersAction
|
||||
* @see google.registry.tools.server.CreateGroupsAction
|
||||
*/
|
||||
@Provides
|
||||
@Config("publicDomainName")
|
||||
public static String providePublicDomainName(RegistryEnvironment environment) {
|
||||
// Change this to your domain name.
|
||||
return "registry.example.com";
|
||||
@Config("gSuiteDomainName")
|
||||
public static String provideGSuiteDomainName(RegistryConfigSettings config) {
|
||||
return config.gSuite.domainName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -490,9 +475,9 @@ public final class RegistryConfig {
|
|||
* @see google.registry.ui.server.registrar.SendEmailUtils
|
||||
*/
|
||||
@Provides
|
||||
@Config("googleAppsSendFromEmailAddress")
|
||||
public static String provideGoogleAppsSendFromEmailAddress() {
|
||||
return String.format("noreply@%s.appspotmail.com", SystemProperty.applicationId.get());
|
||||
@Config("gSuiteOutgoingEmailAddress")
|
||||
public static String provideGSuiteOutgoingEmailAddress(RegistryConfigSettings config) {
|
||||
return config.gSuite.outgoingEmailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -501,10 +486,9 @@ public final class RegistryConfig {
|
|||
* @see google.registry.ui.server.registrar.SendEmailUtils
|
||||
*/
|
||||
@Provides
|
||||
@Config("googleAppsAdminEmailDisplayName")
|
||||
public static String provideGoogleAppsAdminEmailDisplayName() {
|
||||
// Production example: "Example Registry"
|
||||
return "Google Domain Registry";
|
||||
@Config("gSuiteOutoingEmailDisplayName")
|
||||
public static String provideGSuiteOutgoingEmailDisplayName(RegistryConfigSettings config) {
|
||||
return config.gSuite.outgoingEmailDisplayName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1214,25 +1198,15 @@ public final class RegistryConfig {
|
|||
* @see "google.registry.whois.DomainWhoisResponse"
|
||||
* @see "google.registry.whois.RegistrarWhoisResponse"
|
||||
*/
|
||||
public static String getRegistrarDefaultWhoisServer() {
|
||||
switch (RegistryEnvironment.get()) {
|
||||
case UNITTEST:
|
||||
return "whois.nic.fakewhois.example";
|
||||
default:
|
||||
return "whois.nic.registry.example";
|
||||
}
|
||||
public static String getDefaultRegistrarWhoisServer() {
|
||||
return CONFIG_SETTINGS.get().registryPolicy.defaultRegistrarWhoisServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default referral URL that is used unless registrars have specified otherwise.
|
||||
*/
|
||||
public static URL getRegistrarDefaultReferralUrl() {
|
||||
switch (RegistryEnvironment.get()) {
|
||||
case UNITTEST:
|
||||
return makeUrl("http://www.referral.example/path");
|
||||
default:
|
||||
return makeUrl("https://www.registry.example");
|
||||
}
|
||||
public static String getDefaultRegistrarReferralUrl() {
|
||||
return CONFIG_SETTINGS.get().registryPolicy.defaultRegistrarReferralUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,54 +14,60 @@
|
|||
|
||||
package google.registry.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** The POJO that YAML config files are deserialized into. */
|
||||
public class RegistryConfigSettings {
|
||||
|
||||
public AppEngine appEngine;
|
||||
|
||||
public GSuite gSuite;
|
||||
public RegistryPolicy registryPolicy;
|
||||
|
||||
public Datastore datastore;
|
||||
|
||||
public RegistrarConsole registrarConsole;
|
||||
|
||||
public Monitoring monitoring;
|
||||
|
||||
/** Configuration options that apply to the entire App Engine project. */
|
||||
public static class AppEngine {
|
||||
|
||||
public String projectId;
|
||||
}
|
||||
|
||||
/** Configuration options for the G Suite account used by Nomulus. */
|
||||
public static class GSuite {
|
||||
public String domainName;
|
||||
public String outgoingEmailAddress;
|
||||
public String outgoingEmailDisplayName;
|
||||
public String adminAccountEmailAddress;
|
||||
}
|
||||
|
||||
/** Configuration options for registry policy. */
|
||||
public static class RegistryPolicy {
|
||||
|
||||
public String contactAndHostRoidSuffix;
|
||||
|
||||
public String productName;
|
||||
public List<String> registrarChangesNotificationEmailAddresses;
|
||||
public String defaultRegistrarWhoisServer;
|
||||
public String defaultRegistrarReferralUrl;
|
||||
}
|
||||
|
||||
/** Configuration for Cloud Datastore. */
|
||||
public static class Datastore {
|
||||
|
||||
public int commitLogBucketsNum;
|
||||
|
||||
public int eppResourceIndexBucketsNum;
|
||||
}
|
||||
|
||||
/** Configuration for the web-based registrar console. */
|
||||
public static class RegistrarConsole {
|
||||
|
||||
public String logoFilename;
|
||||
public String supportPhoneNumber;
|
||||
public String supportEmailAddress;
|
||||
public String announcementsEmailAddress;
|
||||
public String integrationEmailAddress;
|
||||
public String technicalDocsUrl;
|
||||
}
|
||||
|
||||
/** Configuration for monitoring. */
|
||||
public static class Monitoring {
|
||||
|
||||
public int stackdriverMaxQps;
|
||||
|
||||
public int stackdriverMaxPointsPerRequest;
|
||||
|
||||
public int writeIntervalSeconds;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,18 @@ appEngine:
|
|||
# Globally unique App Engine project ID
|
||||
projectId: domain-registry
|
||||
|
||||
gSuite:
|
||||
# Publicly accessible domain name of the running G Suite instance.
|
||||
domainName: domain-registry.example
|
||||
|
||||
# Display name and email address used on outgoing emails through G Suite.
|
||||
outgoingEmailDisplayName: Example Registry
|
||||
outgoingEmailAddress: noreply@project-id.appspotmail.com
|
||||
|
||||
# Email address of the admin account on the G Suite app. This is used for
|
||||
# logging in to perform administrative actions, not sending emails.
|
||||
adminAccountEmailAddress: admin@example.com
|
||||
|
||||
registryPolicy:
|
||||
# Repository identifier (ROID) suffix for contacts and hosts.
|
||||
contactAndHostRoidSuffix: ROID
|
||||
|
@ -14,6 +26,16 @@ registryPolicy:
|
|||
# Product name of the registry. Used throughout the registrar console.
|
||||
productName: Nomulus
|
||||
|
||||
# List of email addresses that notifications of registrar and/or registrar
|
||||
# contact updates should be sent to, or empty list for no notifications.
|
||||
registrarChangesNotificationEmailAddresses: []
|
||||
|
||||
# Default WHOIS server used when not specified on a registrar.
|
||||
defaultRegistrarWhoisServer: whois.domain-registry.example
|
||||
|
||||
# Default referral URL used when not changed by a registrar.
|
||||
defaultRegistrarReferralUrl: https://www.domain-registry.example
|
||||
|
||||
datastore:
|
||||
# Number of commit log buckets in Datastore. Don't change after initial
|
||||
# install.
|
||||
|
@ -28,6 +50,21 @@ registrarConsole:
|
|||
# relative to ui/assets/images/
|
||||
logoFilename: logo.png
|
||||
|
||||
# Contact phone number for support with the registry.
|
||||
supportPhoneNumber: +1 (888) 555 0123
|
||||
|
||||
# Contact email address for support with the registry.
|
||||
supportEmailAddress: support@example.com
|
||||
|
||||
# From: email address used to send announcements from the registry.
|
||||
announcementsEmailAddress: announcements@example.com
|
||||
|
||||
# Contact email address for questions about integrating with the registry.
|
||||
integrationEmailAddress: integration@example.com
|
||||
|
||||
# URL linking to directory of technical support docs on the registry.
|
||||
technicalDocsUrl: http://example.com/your_support_docs/
|
||||
|
||||
monitoring:
|
||||
# Max queries per second for the Google Cloud Monitoring V3 (aka Stackdriver)
|
||||
# API. The limit can be adjusted by contacting Cloud Support.
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
# This is the configuration file used by unit tests. These values ARE NOT
|
||||
# SUITABLE for use in a real deployed environment.
|
||||
|
||||
registryPolicy:
|
||||
registrarChangesNotificationEmailAddresses:
|
||||
- notification@test.example
|
||||
- notification2@test.example
|
||||
defaultRegistrarWhoisServer: whois.nic.fakewhois.example
|
||||
defaultRegistrarReferralUrl: http://www.referral.example/path
|
||||
|
||||
datastore:
|
||||
commitLogBucketsNum: 3
|
||||
eppResourceIndexBucketsNum: 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue