mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Add octothorpes to disclaimer in exported reserved list
There's no real standard for commented lines in a CSV, but this seems to be the most well-supported option, so may as well use it. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=211847395
This commit is contained in:
parent
9436ce6f0e
commit
72bfd43e00
6 changed files with 27 additions and 12 deletions
|
@ -19,6 +19,7 @@ import static google.registry.config.ConfigUtils.makeUrl;
|
|||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -33,6 +34,7 @@ import java.lang.annotation.Retention;
|
|||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Qualifier;
|
||||
|
@ -1063,7 +1065,13 @@ public final class RegistryConfig {
|
|||
@Provides
|
||||
@Config("reservedTermsExportDisclaimer")
|
||||
public static String provideReservedTermsExportDisclaimer(RegistryConfigSettings config) {
|
||||
return config.registryPolicy.reservedTermsExportDisclaimer;
|
||||
return Splitter.on('\n')
|
||||
.omitEmptyStrings()
|
||||
.trimResults()
|
||||
.splitToList(config.registryPolicy.reservedTermsExportDisclaimer)
|
||||
.stream()
|
||||
.map(s -> "# " + s)
|
||||
.collect(Collectors.joining("\n"));
|
||||
}
|
||||
|
||||
/** Returns the clientId of the registrar used by the {@code CheckApiServlet}. */
|
||||
|
@ -1390,7 +1398,8 @@ public final class RegistryConfig {
|
|||
* <p>Memoizing without cache expiration is used because the app must be re-deployed in order to
|
||||
* change the contents of the YAML config files.
|
||||
*/
|
||||
private static final Supplier<RegistryConfigSettings> CONFIG_SETTINGS =
|
||||
@VisibleForTesting
|
||||
static final Supplier<RegistryConfigSettings> CONFIG_SETTINGS =
|
||||
memoize(YamlUtils::getConfigSettings);
|
||||
|
||||
private RegistryConfig() {}
|
||||
|
|
|
@ -6,6 +6,9 @@ registryPolicy:
|
|||
- notification@test.example
|
||||
- notification2@test.example
|
||||
defaultRegistrarWhoisServer: whois.nic.fakewhois.example
|
||||
reservedTermsExportDisclaimer: |
|
||||
Disclaimer line 1.
|
||||
Line 2 is this 1.
|
||||
|
||||
datastore:
|
||||
commitLogBucketsNum: 3
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class ExportUtils {
|
|||
|
||||
/** Returns the file contents of the auto-export reserved terms document for the given TLD. */
|
||||
public String exportReservedTerms(Registry registry) {
|
||||
StringBuilder termsBuilder = new StringBuilder(reservedTermsExportDisclaimer);
|
||||
StringBuilder termsBuilder = new StringBuilder(reservedTermsExportDisclaimer).append("\n");
|
||||
Set<String> reservedTerms = new TreeSet<>();
|
||||
for (Key<ReservedList> key : registry.getReservedLists()) {
|
||||
ReservedList reservedList = ReservedList.load(key).get();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue