Configuration (v6)
To communicate with the ImageVault service we need to configure the client that we should use. We utilize the Options pattern and the ImageVault Client options is exposed in the ImageVaultClientOptions class. ImageVaultClientOptions
Depending on your configuration, the configuration can reside in multiple places but often just add it to your appsettings.json
file. See more about configuration on the .NET configuration page.
Basic configuration
To be able to access the ImageVault API, you need to supply the address to the ImageVault service and the sdk client id and key that you use.
{
"ImageVault": {
"Client": {
"Url": "https://my.imagevault.app",
"SdkUser": {
"Username": "mySdkId",
"Password": "P@55w0rd!"
}
}
}
}
Url
This points to the base url where the ImageVault service resides. Normally this is an URL that looks like https://customername.imagevault.app
.
Sdk identity
To be able to access the ImageVault, you need to provide an Sdk username/password pair. To retrieve one, ask your ImageVault administrator.
Optional configuration elements
In addition to the mere basic configurations above, you can tweak the default settings by using the following options.
{
"ImageVault": {
"Client": {
"Url": "https://my.imagevault.app",
"ApiUrl": "https://my.imagevault.app/apiv2/",
"UiUrl": "https://my.imagevault.app",
"SdkUser": {
"Username": "mySdkId",
"Password": "mySdkKey"
},
"CurrentUser": {
"Username": "myUser",
"Password": "myPassword"
},
"PublishIdentifier": "MyPublishIdentifier",
"DefaultPublishedMediaUrlBase": "https://my.imagevault.media",
"DefaultMediaUrlBase": "/imagevault/",
"ClientCache": {
"Disabled": true,
"Policies": {
"MediaItem": {
"Expiration": "Sliding",
"Duration": 10
},
"Media": {
"Expiration": "Absolute",
"Duration": 60
}
}
}
}
}
}
ApiUrl
Points to the API endpoint of the ImageVault service.
Defaults to the Url
but with an added suffix of /apiv2/.
UiUrl
Points to the ImageVault UI.
Defaults to the Url
value.
CurrentUser
Used to use another credential pair than the current logged in user when using the IClientFactory.GetCurrentUserClient().
PublishIdentifier
The publishingIdentifier key is optional and if used, will set the PublishIdentifier of the SdkClient.
DefaultPublishedMediaUrlBase
If we uses an external media CDN/proxy then we enter the base address here to generate URL:s to that server. Will only affect published media urls. Internal media will still use the defaultMediaUrlBase configuration.
DefaultMediaUrlBase
The url to use as prefix for all requested media. If left blank all media will use the ImageVault ui url. If you configure the media proxy handlers, you can enter the url to those handlers (often "imagevault").
ClientCache
A brute force client cache is included and is not aware of changes. This is enabled by default. We recommend using this cache on web front ends that mostly work with static data. If the client updates data often, then this should be disabled. The default cache times are 1 minute for MediaItems and 1 hour for Media queries (using sliding cache). It will only affect data populated by the Client.Load or Client.Query methods.
Disabled
If set to true, the cache will not be used.
Policies
To be able to more finely control the cache for different items, the policy value can be configured. A policy is defined by specifying the policy name and its Expiration and Duration.
Policy
The client cache contains multiple types that it can cache. Each type can be configured individually. If not configured, the default setting for each cache will be used. The following cache types are available.
Type | Description | Default duration | Default expiration |
---|---|---|---|
Media | Cache for client Client.Load/Client.Query operations on Media types. | 1440 | Absolute |
MediaItem | Cache for client Client.Load/Client.Query operations on MediaItem types. | 60 | Absolute |
Expiration (optional)
Can be either Absolute or Sliding. Absolute will expire the cached item when the duration time is up. Sliding will expire the item if it hasn't been accessed before the duration time is up. Default value is Absolute.
Duration (optional)
The number of minutes the cache should be kept. If you only specify Expiration the Duration will default to 0