diff --git a/Cognite.Config/Configuration.cs b/Cognite.Config/Configuration.cs
index 331eccaf..016f53a8 100644
--- a/Cognite.Config/Configuration.cs
+++ b/Cognite.Config/Configuration.cs
@@ -96,7 +96,8 @@ public static int GetVersionFromString(string yaml)
///
/// Try to read a configuration object of type from the provided
- /// string. Matching the configuration object version with the versions provided in
+ /// string. Matching the configuration object version with the versions provided in .
+ /// Also calls GenerateDefaults() on the retrieved configuration object after reading.
///
/// String containing a yaml configuration
/// Accepted versions
@@ -108,13 +109,17 @@ public static T TryReadConfigFromString(string yaml, params int[] acceptedCon
{
int configVersion = ConfigurationUtils.GetVersionFromString(yaml);
CheckVersion(configVersion, acceptedConfigVersions);
- return ConfigurationUtils.ReadString(yaml);
+
+ var config = ConfigurationUtils.ReadString(yaml);
+ config.GenerateDefaults();
+ return config;
}
///
/// Try to read a configuration object of type from the yaml file located in
/// the provided . Matching the configuration object version with the versions
- /// provided in
+ /// provided in .
+ /// Also calls GenerateDefaults() on the retrieved configuration object after reading.
///
/// Path to the yml file
/// Accepted versions
@@ -127,7 +132,9 @@ public static T TryReadConfigFromFile(string path, params int[] acceptedConfi
int configVersion = ConfigurationUtils.GetVersionFromFile(path);
CheckVersion(configVersion, acceptedConfigVersions);
- return ConfigurationUtils.Read(path);
+ var config = ConfigurationUtils.Read(path);
+ config.GenerateDefaults();
+ return config;
}
///
diff --git a/ExtractorUtils.Test/ConfigurationTest.cs b/ExtractorUtils.Test/ConfigurationTest.cs
index 8e745265..500b0274 100644
--- a/ExtractorUtils.Test/ConfigurationTest.cs
+++ b/ExtractorUtils.Test/ConfigurationTest.cs
@@ -158,7 +158,7 @@ public static void TestEmptyVersion()
public static void TestGenerateDefaults()
{
var yaml = "version: 0";
- var conf = ConfigurationUtils.TryReadConfigFromString(yaml);
+ var conf = ConfigurationUtils.ReadString(yaml);
Assert.Null(conf.Cognite);
Assert.Null(conf.Logger);
Assert.Null(conf.Metrics);