The purpose of the configuration service is to provide an easy, centralized, and isolated way to access and modify common platform configuration.
- Get all packages
- Get specific packages
- Add packages
- Add settings to package
- Remove settings from package
- Delete package
- Case-(In)sensitivity: Keys are matched in an case-insensitive invariant manner, however keys MAY have casing for formatting purposes when created.
When creating settings, you may reference other settings by key. The value will be subsituted at resolve-time. This allows for creating small and purposeful settings that are clear, but still bring them together in a template setting. *A template setting is any setting with a value containing a substitution.
Key | Value |
---|---|
First.Name | Ada |
Last.Name | Lovelace |
FullName | {First.Name } {Last.Name } |
Extending upon subsitutions, you can use JSON objects and Arrays as the values of settings. Subsitutions can then access properties or indexes in a deep fashion.
Key | Value |
---|---|
Person | { FirstName: "Ada", LastName: "Lovelace" } |
Person.Name | {Person["FirstName"] } {Person["LastName"] } |
Resolving Person.Name would result in: "Ada Lovelace".
Key | Value |
---|---|
HexColors | [ "FF0000", "00FF00", "0000FF" ] |
Red | 0x{HexColors[0] } |
Green | 0x{HexColors[1] } |
Blue | 0x{HexColors[2] } |
Here you can see array indexers in action.
Route: GET /settings
Get all configuration settings.
Returns: All configured settings.
{
"ValueTemplate": "Value",
"Key1": "{ValueTemplate}1",
"Key2": "{ValueTemplate}2",
"Key3": "{ValueTemplate}3",
"Key4": "{ValueTemplate}4"
}
Route: GET /settings?keys={Key1},{Key2},{Key3}...
Get specified configuration keys.
- keys - The desired configuration setting key.
Returns: Specified configured settings.
{
"Key1": "{ValueTemplate}1",
"Key2": "{ValueTemplate}2",
"Key3": "{ValueTemplate}3"
}
Where Key1, Key2, and Key3 represent the keys requested via the keys query string parameter.
Route: POST /settings
Add configuration key/values. If any configuration value fails to be added due to the key already existing, the POST operation is considered to be void and none of the values are added.
Request Body (Content-Type: application/json
)
{
"NewKey1": "NewValue1",
"NewKey2": "NewValue2"
}
Returns: The same object that was passed as the request in order to acknowledge the creation of the configuration records.
{
"NewKey1": "NewValue1",
"NewKey2": "NewValue2"
}
Route: PUT /settings/{Key}
Update an existing configuration key to the provided value in the request body.
- Key - The key of an existing configuration setting.
Request Body (Content-Type: text/plain
)
TheValueThatIWantTheKeyToBeUpdatedTo
Returns: Updated version of the configuration record as success acknowledgment.
Route: DELETE /settings/{Key}
Delete an existing configuration key.
- Key - The key of an existing configuration setting.
Returns: 204 No Content
Route: GET /resolve/settings?keys={Key1},{Key2},{Key3}...
Get specified settings after resolving all nested values.
- keys - The desired configuration setting keys.
Returns: Specified configured settings with resolved values.
{
"Key1": "Value1",
"Key2": "Value2",
"Key3": "Value3",
"Key4": "Value4"
}
Route: GET /packages
Get all packages.
Returns: All configured settings packages.
[
{
"key": "PackageA",
"settings": {
"Config.ConnString": "server={Config.Server};",
"Config.User": "configuser"
}
},
{
"key": "PackageB",
"settings": {
"Db.Password": "RealPassword123",
"Db.Server": "db",
"Github.Password": "testgithubpass",
"Github.User": "testgithubuser"
}
}
]
Route: GET /packages?keys={PackageA}
Get specific packages.
- keys - The desired package key.
Returns: Specified packages.
[
{
"key": "PackageA",
"settings": {
"Config.ConnString": "server={Config.Server};",
"Config.User": "configuser"
}
}
]
Route: POST /packages
Add settings packages. If any package key fails to be added due to the key already existing, the POST operation is considered to be void and none of the values are added.
Multiple packages may be defined.
Request Body (Content-Type: application/json
)
{
"PackageKeyA": [
"SettingKeyA",
"SettingKeyB"
],
"PackageKeyB": [
"SettingKeyC",
"SettingKeyD"
]
}
Returns: The an array of packages including the raw settings values as a confirmation.
[
{
"Key": "PackageA",
"Settings": {
"SettingKeyA": "SettingValueA",
"SettingKeyB": "SettingValueB"
}
},
{
"Key": "PackageB",
"Settings": {
"SettingKeyC": "SettingValueC",
"SettingKeyD": "SettingValueD"
}
}
]
Route: POST /packages/{packageKey}/settings?keys={Key1},{Key2}...
Append settings to an existing package.
- packageKey - The key of an existing package.
- keys - The key of existing configuration settings.
Returns: The the package including the raw settings values as a confirmation.
{
"Key": "PackageKey",
"Settings": {
"Key1": "SettingValueA",
"Key2": "SettingValueB"
}
}
Route: DELETE /packages/{packageKey}/settings?keys={Key2}...
Remove settings from an existing package.
- packageKey - The key of an existing package.
- keys - The key of existing configuration settings currently bound to the package.
Returns: The the package including the raw settings values as a confirmation.
{
"Key": "PackageKey",
"Settings": {
"Key1": "SettingValueA"
}
}
Route: DELETE /packages/{Key}
Delete an existing package.
- Key - The key of an existing settings package.
Returns: 204 No Content
Route: GET /resolve/packages?keys={PackageKeyA}...
Get specified packages after resolving all nested settings values.
- keys - The desired package keys.
Returns: Specified packages with resolved settings.
[
{
"key": "PackageKeyA",
"settings": {
"Config.ConnString": "server=resolvedServerName;",
"Config.User": "configuser"
}
}
]