Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Remove support for old settings controller format. Fixes #644
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebbo committed Nov 19, 2014
1 parent f55cfb5 commit f0a8b0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
2 changes: 0 additions & 2 deletions Kudu.FunctionalTests/SettingsApiFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ public void GetAllValues()
appManager.SettingsManager.SetValue("y", "2").Wait();
appManager.SettingsManager.SetValue("z", "3").Wait();
NameValueCollection resultsLegacy = appManager.LegacySettingsManager.GetValues().Result;
NameValueCollection results = appManager.SettingsManager.GetValues().Result;
// Assert
CheckSettings(resultsLegacy);
CheckSettings(results);
});
}
Expand Down
32 changes: 2 additions & 30 deletions Kudu.Services/Settings/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,37 +103,9 @@ public HttpResponseMessage Delete(string key)
/// Get the list of all settings
/// </summary>
/// <returns></returns>
public HttpResponseMessage GetAll(int version = 1)
public HttpResponseMessage GetAll()
{
/*
Old format looks like this:
[
{
Key: "branch",
Value: "master"
},
{
Key: "foo",
Value: "123"
}
]
New format looks like:
{
branch: "master",
foo: "123"
}
*/

var values = _settingsManager.GetValues();

if (version < 2)
{
var legacyValues = values.Select(pair => new Dictionary<string, string> { { "key", pair.Key }, { "value", pair.Value } });
return Request.CreateResponse(HttpStatusCode.OK, legacyValues);
}

return Request.CreateResponse(HttpStatusCode.OK, values);
return Request.CreateResponse(HttpStatusCode.OK, _settingsManager.GetValues());
}

/// <summary>
Expand Down

0 comments on commit f0a8b0f

Please sign in to comment.