Move more environment-specific settings into YAML configuration

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146164592
This commit is contained in:
mcilwain 2017-01-31 14:15:33 -08:00 committed by Ben McIlwain
parent e04bea39f1
commit a061f74ee7
5 changed files with 100 additions and 74 deletions

View file

@ -86,12 +86,8 @@ gSuite:
For fully-featured production environments that need the full range of features For fully-featured production environments that need the full range of features
(e.g. RDE, correct contact information on the registrar console, etc.) you will (e.g. RDE, correct contact information on the registrar console, etc.) you will
need to provide configuration for the settings in the following sections: need to specify more settings. The `nomulus-config-production-sample.yaml` file
contains an exhaustive list of all settings to override.
* `appEngine:`
* `gSuite:`
* `registryPolicy:`
* `registrarConsole:`
From a code perspective, all configuration settings ultimately come through the From a code perspective, all configuration settings ultimately come through the
`[RegistryConfig][registry-config]` class. This includes a Dagger module called `[RegistryConfig][registry-config]` class. This includes a Dagger module called

View file

@ -284,20 +284,6 @@ public final class RegistryConfig {
return Duration.standardDays(7); return Duration.standardDays(7);
} }
/**
* Returns {@code true} if the target zone should be created in DNS if it does not exist.
*/
@Provides
@Config("dnsCreateZone")
public static boolean provideDnsCreateZone(RegistryEnvironment environment) {
switch (environment) {
case PRODUCTION:
return false;
default:
return true;
}
}
/** /**
* The maximum number of domain and host updates to batch together to send to * The maximum number of domain and host updates to batch together to send to
* PublishDnsUpdatesAction, to avoid exceeding AppEngine's limits. * PublishDnsUpdatesAction, to avoid exceeding AppEngine's limits.
@ -409,13 +395,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("tmchCaMode") @Config("tmchCaMode")
public static TmchCaMode provideTmchCaMode() { public static TmchCaMode provideTmchCaMode(RegistryConfigSettings config) {
switch (RegistryEnvironment.get()) { return TmchCaMode.valueOf(config.registryPolicy.tmchCaMode);
case PRODUCTION:
return TmchCaMode.PRODUCTION;
default:
return TmchCaMode.PILOT;
}
} }
/** The mode that the {@code TmchCertificateAuthority} operates in. */ /** The mode that the {@code TmchCertificateAuthority} operates in. */
@ -440,13 +421,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("tmchCrlUrl") @Config("tmchCrlUrl")
public static URL provideTmchCrlUrl(RegistryEnvironment environment) { public static URL provideTmchCrlUrl(RegistryConfigSettings config) {
switch (environment) { return makeUrl(config.registryPolicy.tmchCrlUrl);
case PRODUCTION:
return makeUrl("http://crl.icann.org/tmch.crl");
default:
return makeUrl("http://crl.icann.org/tmch_pilot.crl");
}
} }
/** /**
@ -459,14 +435,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("tmchMarksdbUrl") @Config("tmchMarksdbUrl")
public static String provideTmchMarksdbUrl(RegistryEnvironment environment) { public static String provideTmchMarksdbUrl(RegistryConfigSettings config) {
switch (environment) { return config.registryPolicy.tmchMarksDbUrl;
case PRODUCTION:
case UNITTEST:
return "https://ry.marksdb.org";
default:
return "https://test.ry.marksdb.org";
}
} }
/** /**
@ -558,13 +528,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("rdeReportUrlPrefix") @Config("rdeReportUrlPrefix")
public static String provideRdeReportUrlPrefix(RegistryEnvironment environment) { public static String provideRdeReportUrlPrefix(RegistryConfigSettings config) {
switch (environment) { return config.rde.reportUrlPrefix;
case PRODUCTION:
return "https://ry-api.icann.org/report/registry-escrow-report";
default:
return "https://test-ry-api.icann.org:8543/report/registry-escrow-report";
}
} }
/** /**
@ -638,13 +603,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("rdeUploadUrl") @Config("rdeUploadUrl")
public static URI provideRdeUploadUrl(RegistryEnvironment environment) { public static URI provideRdeUploadUrl(RegistryConfigSettings config) {
switch (environment) { return URI.create(config.rde.uploadUrl);
case PRODUCTION:
return URI.create("sftp://GoogleTLD@sftpipm2.ironmountain.com/Outbox");
default:
return URI.create("sftp://google@ppftpipm.ironmountain.com/Outbox");
}
} }
/** /**
@ -678,20 +638,8 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("sheetRegistrarId") @Config("sheetRegistrarId")
public static Optional<String> provideSheetRegistrarId(RegistryEnvironment environment) { public static Optional<String> provideSheetRegistrarId(RegistryConfigSettings config) {
switch (environment) { return Optional.fromNullable(config.misc.sheetExportId);
case PRODUCTION:
return Optional.of("1n2Gflqsgo9iDXcdt9VEskOVySZ8qIhQHJgjqsleCKdE");
case ALPHA:
case CRASH:
return Optional.of("16BwRt6v11Iw-HujCbAkmMxqw3sUG13B8lmXLo-uJTsE");
case SANDBOX:
return Optional.of("1TlR_UMCtfpkxT9oUEoF5JEbIvdWNkLRuURltFkJ_7_8");
case QA:
return Optional.of("1RoY1XZhLLwqBkrz0WbEtaT9CU6c8nUAXfId5BtM837o");
default:
return Optional.absent();
}
} }
/** /**

View file

@ -1,11 +1,11 @@
// Copyright 2017 The Nomulus Authors. All Rights Reserved. // Copyright 2017 The Nomulus Authors. All Rights Reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -23,8 +23,10 @@ public class RegistryConfigSettings {
public GSuite gSuite; public GSuite gSuite;
public RegistryPolicy registryPolicy; public RegistryPolicy registryPolicy;
public Datastore datastore; public Datastore datastore;
public Rde rde;
public RegistrarConsole registrarConsole; public RegistrarConsole registrarConsole;
public Monitoring monitoring; public Monitoring monitoring;
public Misc misc;
/** Configuration options that apply to the entire App Engine project. */ /** Configuration options that apply to the entire App Engine project. */
public static class AppEngine { public static class AppEngine {
@ -46,6 +48,9 @@ public class RegistryConfigSettings {
public List<String> registrarChangesNotificationEmailAddresses; public List<String> registrarChangesNotificationEmailAddresses;
public String defaultRegistrarWhoisServer; public String defaultRegistrarWhoisServer;
public String defaultRegistrarReferralUrl; public String defaultRegistrarReferralUrl;
public String tmchCaMode;
public String tmchCrlUrl;
public String tmchMarksDbUrl;
} }
/** Configuration for Cloud Datastore. */ /** Configuration for Cloud Datastore. */
@ -54,6 +59,12 @@ public class RegistryConfigSettings {
public int eppResourceIndexBucketsNum; public int eppResourceIndexBucketsNum;
} }
/** Configuration for Registry Data Escrow (RDE). */
public static class Rde {
public String reportUrlPrefix;
public String uploadUrl;
}
/** Configuration for the web-based registrar console. */ /** Configuration for the web-based registrar console. */
public static class RegistrarConsole { public static class RegistrarConsole {
public String logoFilename; public String logoFilename;
@ -70,4 +81,9 @@ public class RegistryConfigSettings {
public int stackdriverMaxPointsPerRequest; public int stackdriverMaxPointsPerRequest;
public int writeIntervalSeconds; public int writeIntervalSeconds;
} }
/** Miscellaneous configuration that doesn't quite fit in anywhere else. */
public static class Misc {
public String sheetExportId;
}
} }

View file

@ -1,7 +1,9 @@
# This is the default configuration file for Nomulus. Do not make changes to it # This is the default configuration file for Nomulus. Do not make changes to it
# unless you are writing new features that requires you to. To customize an # unless you are writing new features that requires you to. To customize an
# 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. You may need
# to override some of these values to configure and enable some services used in
# production environments.
appEngine: appEngine:
# Globally unique App Engine project ID # Globally unique App Engine project ID
@ -36,6 +38,16 @@ registryPolicy:
# Default referral URL used when not changed by a registrar. # Default referral URL used when not changed by a registrar.
defaultRegistrarReferralUrl: https://www.domain-registry.example defaultRegistrarReferralUrl: https://www.domain-registry.example
# Mode TMCH should run in (PRODUCTION for production environments, PILOT for
# all others including sandbox).
tmchCaMode: PILOT
# URL for the ICANN TMCH Certificate Revocation List.
tmchCrlUrl: http://crl.icann.org/tmch_pilot.crl
# URL for the MarksDB registry interface.
tmchMarksDbUrl: https://test.ry.marksdb.org
datastore: datastore:
# 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.
@ -45,6 +57,16 @@ datastore:
# initial install. # initial install.
eppResourceIndexBucketsNum: 997 eppResourceIndexBucketsNum: 997
rde:
# URL prefix of ICANN's server to upload RDE reports to. Nomulus adds /TLD/ID
# to the end of this to construct the full URL.
reportUrlPrefix: https://test-ry-api.icann.org:8543/report/registry-escrow-report
# SFTP URL to which RDE deposits are uploaded. This should contain a username
# but not the password.
uploadUrl: sftp://username@rde-provider.example
registrarConsole: registrarConsole:
# Filename of the logo to use in the header of the console. This filename is # Filename of the logo to use in the header of the console. This filename is
# relative to ui/assets/images/ # relative to ui/assets/images/
@ -76,3 +98,8 @@ monitoring:
# How often metrics are exported to BigQuery. # How often metrics are exported to BigQuery.
writeIntervalSeconds: 60 writeIntervalSeconds: 60
misc:
# The ID of the Google Sheet (as found in the URL) to export registrar details
# to. Leave this null to disable syncing.
sheetExportId: null

View file

@ -0,0 +1,39 @@
# This is a sample production config (to be deployed in the WEB-INF directory).
# This is the same as what Google Registry runs in production, except with
# placeholders for Google-specific settings.
appEngine:
projectId: placeholder
gSuite:
domainName: placeholder
outgoingEmailDisplayName: placeholder
outgoingEmailAddress: placeholder
adminAccountEmailAddress: placeholder
registryPolicy:
contactAndHostRoidSuffix: placeholder
productName: placeholder
registrarChangesNotificationEmailAddresses:
- placeholder
- placeholder
defaultRegistrarWhoisServer: placeholder
defaultRegistrarReferralUrl: placeholder
tmchCaMode: PRODUCTION
tmchCrlUrl: http://crl.icann.org/tmch.crl
tmchMarksDbUrl: https://ry.marksdb.org
rde:
reportUrlPrefix: https://ry-api.icann.org/report/registry-escrow-report
uploadUrl: sftp://placeholder@sftpipm2.ironmountain.com/Outbox
registrarConsole:
logoFilename: placeholder
supportPhoneNumber: placeholder
supportEmailAddress: placeholder
announcementsEmailAddress: placeholder
integrationEmailAddress: placeholder
technicalDocsUrl: https://drive.google.com/drive/folders/placeholder
misc:
sheetExportId: placeholder