Doconut 옵션
Doconut 서비스 구성
DoconutOptions (namespace Doconut) 은 전체 SDK에 대한 단일 구성 객체입니다. AddDoconut() 내부에서 한 번만 구성하면 싱글톤으로 등록됩니다.
builder.Services.AddDoconut(options =>
{
options.LicensePath = "Doconut.Viewer.lic";
options.UnsafeMode = false;
options.ShowDoconutInfo = false;
options.AddPlugin<Doconut.Plugins.Dicom.DicomPlugin>();
});속성
| 형식 | 속성 | 기본값 | 설명 |
|---|---|---|---|
bool | ShowDoconutInfo | false | true일 경우 토큰이 없는 미들웨어 요청이 404 대신 버전 배너(Doconut <version> is running on <host>)를 반환합니다. 스모크 체크에 유용하며, 프로덕션에서는 false로 유지하십시오. |
bool | UnsafeMode | false | true일 경우 페이지 요청 시 ASP.NET 세션 보안 검사를 건너뜁니다. 프로덕션에서는 false로 유지하십시오 (Core Concepts → Sessions & Security 참조). |
string | MiddlewarePath | "/doconut" | 페이지-이미지 엔드포인트의 조정 값입니다. 검증은 되지만 파이프라인 분기를 마운트하지 않으므로 실제 UseDoconut() 매핑 및 클라이언트 BasePath와 일치하도록 유지하십시오. |
string | ResourcesPath | "/doconut-res" | 임베드된 JS/CSS/이미지/폰트 리소스의 URL 경로 접두사입니다. |
string | LicensePath | "" | 라이선스 파일 경로입니다. 빈 문자열이면 다음 라이선스 소스로 이동하고 자동 검색을 시도합니다; 찾지 못하면 기능이 제한된 워터마크가 있는 평가 상태가 됩니다. |
string | LicenseContent | "" | 원시 XML 라이선스 내용(데이터베이스, 환경 변수, 시크릿 매니저). LicensePath보다 우선합니다. |
Stream? | LicenseStream | null | 시작 시 한 번 읽는 스트림 형태의 라이선스입니다. 다른 두 소스보다 우선합니다. |
bool | ResetLicense | false | 예약된 호환성 플래그입니다. 현재 .NET 6 구현에서는 사용되지 않으며, 라이선스를 교체한 후 애플리케이션을 재시작하십시오. |
DoconutPluginRegistry | PluginRegistry | — | 플러그인 기여를 수집하는 읽기 전용 레지스트리이며, 뷰어 팩토리에서 사용됩니다. AddPlugin<T>()를 통해 채웁니다. |
라이선스 우선순위(서비스 등록 시 적용): LicenseStream → LicenseContent → LicensePath → 자동 검색 (Getting Started → License Setup 참조).
메서드
AddPlugin<TPlugin>()
DoconutOptions AddPlugin<TPlugin>() where TPlugin : IDoconutPlugin, new()이 메서드는 출시된 옵트인 Converter 및 DICOM 패키지에 사용합니다. Annotation 및 일반 Search는 내장된 라이선스 기능이며 AddPlugin<TPlugin>()를 사용하지 않습니다.
첫 번째 파티 플러그인(Converter, DICOM)을 등록합니다. Fluent 방식이며 옵션 인스턴스를 반환합니다. AddDoconut()는 라이선스가 없거나 레거시 TRIAL 파일이 있거나 플러그인 기능을 부여하지 않는 유료 라이선스인 경우 InvalidOperationException을 발생시킵니다. 임시/데모 등록은 만료 후에도 유지되며 런타임 게이트의 적용을 받습니다 (Core Concepts → Plugin System 참조).
옵트인 Converter 위젯은 AddConverterWidget()으로 활성화되며 읽기 전용 ConverterWidget 속성을 통해 노출됩니다; 해당 옵션은 Converter Plugin 페이지(Plugins → Converter Plugin)에서 문서화되어 있습니다.
RegisterViewer(extension, factory, defaultConfig?)
DoconutOptions RegisterViewer(
string extension, // ".myext" — leading dot optional
Func<IFormatViewer> factory,
Func<BaseConfig>? defaultConfig = null)파일 확장자에 대한 사용자 지정 뷰어를 등록합니다. 사용자 지정 뷰어는 내장 및 플러그인 뷰어보다 우선하며 라이선스 제한을 받지 않습니다. defaultConfig가 생략되고 문서가 명시적 구성 없이 열릴 경우 ImageConfig가 사용됩니다.
빈 확장자에 대해서는 ArgumentException(Extension must be a non-empty file extension.)을, null 팩토리에는 ArgumentNullException을 발생시킵니다.
시작 시 검증
AddDoconut()는 옵션을 빠르게 실패하도록 검증하므로, 잘못된 구성은 요청 시 혼란스러운 404 대신 시작 시 명확한 예외로 표시됩니다:
DoconutOptions.MiddlewarePath must be a non-empty path starting with '/'.
DoconutOptions.ResourcesPath must be a non-empty path starting with '/'.
DoconutOptions.MiddlewarePath and ResourcesPath must be different paths.일반 구성
// Production: explicit license, everything locked down (all security defaults)
builder.Services.AddDoconut(options =>
{
options.LicenseContent = builder.Configuration["Doconut:License"] ?? "";
});
// Custom paths (e.g. to avoid a route conflict)
builder.Services.AddDoconut(options =>
{
options.MiddlewarePath = "/docs-engine";
options.ResourcesPath = "/docs-assets";
});ResourcesPath를 변경할 경우 클라이언트 위젯의 ResPath를 동기화하십시오 (ViewerConfig 참조).
MiddlewarePath는 자동 ASP.NET Core 라우트 매퍼가 아닙니다. Doconut이 사용자 지정 프리픽스 아래에서만 응답하도록 하려면 해당 브랜치에 UseDoconut()를 마운트하십시오(예: app.Map("/docs-engine", branch => branch.UseDoconut())). 그리고 클라이언트 BasePath를 동일한 URL로 설정하십시오.
이 페이지가 도움이 되었나요?