Files
Umbraco-CMS/src/Umbraco.Cms.ManagementApi/Configuration/ConfigureMvcOptions.cs
Bjarke Berg 48954bb36a New Backoffice - Exposing hardcoded Open API contract (#12953)
* Only expose swagger ui when in development

* Only expose swagger ui when in development + Test confirming the contract is respected + contract

* Rollback test code

* Fix up formatting

* Add reference to managementapi in integration tests.

* Revert "Add reference to managementapi in integration tests."

This reverts commit 67e2bf827758767e9031d40d146d6f27fd6c031e.

* Fix integration tests

* Add reference to management api in integration tests

* Fix up schema

* Fixed tests

* Fix test.. do not execute that composer twice

* Revert "Updated dependencies and fixed new NRT issues"

This reverts commit b2b2903a6e.

* Added debug info to test, to debug on azure pipeline

* Try and fix OpenApi test

* Only run test in release

* Try fixing OpenApi.json

Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch>
2022-09-20 09:50:34 +02:00

27 lines
841 B
C#

using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.New.Cms.Web.Common.Routing;
namespace Umbraco.Cms.ManagementApi.Configuration;
public class ConfigureMvcOptions : IConfigureOptions<MvcOptions>
{
private readonly IOptions<GlobalSettings> _globalSettings;
public ConfigureMvcOptions(IOptions<GlobalSettings> globalSettings)
{
_globalSettings = globalSettings;
}
public void Configure(MvcOptions options)
{
// Replace the BackOfficeToken in routes.
var backofficePath = _globalSettings.Value.UmbracoPath.TrimStart(Constants.CharArrays.TildeForwardSlash);
options.Conventions.Add(new UmbracoBackofficeToken(Constants.Web.AttributeRouting.BackOfficeToken, backofficePath));
}
}