I use the custom settings to store connection strings to other minor satelite databases, URLs to some external services and other things that could be stored in the web.config appSettings section but change in our different environments. I'm finding now that the values displayed in the UI, what is stored in the database and what is retrieved via the API are all different/incorrect.
For instance I have a URL to a service I use for credit checking/reporting. I entered the new Key in our dev server I used a code name of AppUrl, selected my group (which is the same as my site code name), set the type to string and entered a default value of https://test.creditcheckersolutions.com/. I then went and synced that key over using Content Staging. When I went to the live site, I saw exactly as I had entered. So I changed the default value in the UI to https://live.creditchecksolutions.com/ expecting that when I used
SettingsKeyProvider.GetStringValue(CMSContext.CurrentSiteName + ".AppUrl");
I would get back https://live.creditchecksolutions.com/. I was mistaken, I'm receiving the initial value (KeyValue) that was entered and not the value I updated in the UI (KeyDefaultValue).
When I look in the database I see there are 2 fields in the CMS_SettingsKey table, KeyValue and KeyDefaultValue. It appears on creation of the Key both the KeyValue and KeyDefaultValue are set to what is entered in the Default value field. When I went to live and updated the default value only the KeyDefaultValue was updated and the KeyValue field (which is returned by the method above) had the incorrect value in it.
Is this by design? I hope not. I'm using v7.0.40 and didn't see anything in Bugtracker stating this was resolved or reported in any newer hotfixes.