London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Loading...

Installation and configuration

This topic describes how to install and configure content synchronization as part of the Optimizely GraphQL querying service.

Installation

Install the Optimizely.Query.Synchronizer package to the Optimizely site.
Enter install-package Optimizely.Query.Synchronizer -prerelease at the Package Manager Console prompt (PM> ) in Visual Studio.

After install Optimizely.Query.Synchronizer package successfully, you can install the Optimizely.Query.Commerce.Synchronizer package to the Optimizely site to add the capacities of Optimizely Query for Commerce.
Enter install-package Optimizely.Query.Commerce.Synchronizer  -prerelease at the Package Manager Console prompt (PM> ) in Visual Studio.

Note: We are now supporting packages for .Net 5 with the package versions >= 0.5

Configuration

Setting options

  • GatewayAddress. URL to the API Gateway. This value should be set to https://optimizely.gq for all production environments.
  • AppKey. The "appkey" received when the account was created. This key is the public part of your HMAC authentication.
  • Secret. The "secret" received when the account was created. This key is the secret part of your HMAC authentication.
  • SingleKey. The "singlekey" received when the account was created. This key is the public key, which can be used on the public site.
  • AllowSendingLog. Permission that allows sending errors or warnings to the API Gateway, for support when something goes wrong. Default: "true".

For .Net Framework

Open web.config and modify the following keys in the <appSettings> section to configure your account.

<add key="optimizely__query__gatewayaddress" value="" />
<add key="optimizely__query__appkey" value="" />
<add key="optimizely__query__secret" value="" />
<add key="optimizely__query__singlekey" value="" />
<add key="optimizely__query__allowsendinglog" value="true"/>
Note: The following config is still working but obsoleted.
<add key="optimizely:gatewayaddress" value="" />
<add key="optimizely:query.appkey" value="" />
<add key="optimizely:query.secret" value="" />
<add key="optimizely:query.singlekey" value="" />
<add key="optimizely:allowsendinglog" value="true"/>​

For .Net 5

Open appsettings.json and add the following settings to configure your account.

    "Optimizely": {
        "Query": {
            "GatewayAddress": "",
            "AppKey": "",
            "Secret": "",
            "SingleKey": "",
            "AllowSendingLog": "true"
        }
    }

In the ConfigureServices(IServiceCollection services) of Startup.cs:

If Optimizely.Query.Commerce.Synchronizer  package is installed, add the following code:

            var queryOptions = _configuration.GetSection("Optimizely:Query");
            services.AddCommerceQuerySynchronizer(options =>
            {
                options.BaseAddress = queryOptions["GatewayAddress"];
                options.AppKey = queryOptions["AppKey"];
                options.Secret = queryOptions["Secret"];
                options.SingleKey = queryOptions["SingleKey"];
            });


If only Optimizely.Query.Synchronizer package is installed, add the following code:

            var queryOptions = _configuration.GetSection("Optimizely:Query");
            services.AddCmsQuerySynchronizer(options =>
            {
                options.BaseAddress = queryOptions["GatewayAddress"];
                options.AppKey = queryOptions["AppKey"];
                options.Secret = queryOptions["Secret"];
                options.SingleKey = queryOptions["SingleKey"];
            });

 

Last updated: Jan 04, 2021