(#23373) Don't apply all metadata

The previous code would always apply all of the metadata that it got
from the configuration file. This caused unused sections to override
default metadata, when the section of the config file that was really
being used did not specify any metadata. Instead of trying to apply
everything, this now just tries to use the data from the section that is
currently in use.