From ce871d8c7b96e351951d879a4946a303fa20862e Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sun, 11 Jun 2023 16:00:48 -0300 Subject: [PATCH] Improve configuration docs --- src/Mockaco/Settings/appsettings.json | 6 +-- website/docs/configuration/index.md | 66 ++++++++++++++++++++++----- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/src/Mockaco/Settings/appsettings.json b/src/Mockaco/Settings/appsettings.json index c522b29..7169ce6 100644 --- a/src/Mockaco/Settings/appsettings.json +++ b/src/Mockaco/Settings/appsettings.json @@ -5,9 +5,9 @@ "DefaultHttpContentType": "application/json", "References": [], "Imports": [], - "MatchedRoutesCacheDuration": 60, - "VerificationEndpointName": "verification", - "VerificationEndpointPrefix": "_mockaco" + "MatchedRoutesCacheDuration": 60, + "MockacoEndpoint": "_mockaco", + "VerificationEndpointName": "verification" }, "AllowedHosts": "*", "Serilog": { diff --git a/website/docs/configuration/index.md b/website/docs/configuration/index.md index df1bc6e..045ece5 100644 --- a/website/docs/configuration/index.md +++ b/website/docs/configuration/index.md @@ -1,61 +1,103 @@ # Configuration -The configuration can be made in the `appsettings.json` file inside `Settings` folder. +The configuration for Mockaco can be easily customized using the appsettings*.json files located within the Settings folder. These files allow you to configure various options provided by ASP.NET Core. -## `DefaultHttpStatusCode` +Here are the different appsettings*.json files and their purposes: + +- *appsettings.Production.json*: Use this file to customize Mockaco when running it as an executable or dotnet tool. +- *appsettings.Docker.json*: This file is specifically used to customize Mockaco when running it within a Docker container. +- *appsettings.Development.json*: When running Mockaco in debug mode, such as inside Visual Studio, you can use this file to customize its behavior. This environment is typically set through the launchSettings.json file. + +These appsettings*.json files provide a convenient way to adjust Mockaco's settings based on the specific environment in which it is running. + +To customize Mockaco, locate the appropriate appsettings*.json file based on your deployment scenario and modify the configuration options according to your requirements. + +For instance you could override the default URLs Mockaco will listen to, just by changing the configuration like this: + +```json +{ + "Urls": "http://+:8080;https://+:8443" +} +``` + +Mockaco specific options are listed in the next topics. + +## Mockaco + +```json +{ + "Mockaco": { + "DefaultHttpStatusCode": "OK", + "ErrorHttpStatusCode": "NotImplemented", + "DefaultHttpContentType": "application/json", + "References": [], + "Imports": [], + "MatchedRoutesCacheDuration": 60, + "MockacoEndpoint": "_mockaco", + "VerificationEndpointName": "verification" + } +} +``` + +### `DefaultHttpStatusCode` Set the default HTTP status code returned when the mock does not specify one. Default: `OK` (200) -## `ErrorHttpStatusCode` +### `ErrorHttpStatusCode` Set the default HTTP status code in case there is no matching mock available. Default: `NotImplemented` (501) -## `DefaultHttpContentType` +### `DefaultHttpContentType` Set the default HTTP `Content-Type` header response when the mock does not specify one. Default: `application/json` -## `References` +### `References` A list of references to other .NET assemblies to extend scripting engine. Default: `[]` -## `Imports` +### `Imports` A list of namespaces to be imported and made available in scripting engine. Default: `[]` -## `MatchedRoutesCacheDuration` +### `MatchedRoutesCacheDuration` Set the cache duration in minutes to be used by the verification endpoint. Default: `60` -## `MockacoEndpoint` +### `MockacoEndpoint` The exclusive endpoint to access internal features. Default: `_mockaco` -## `VerificationEndpointName` +### `VerificationEndpointName` The name of the verification endpoint. Default: `verification` -## `TemplateFileProvider` +### `TemplateFileProvider` Configure the mock template file provider. -### `Path` +#### `Path` Define the mock template files path. -Default: `Mocks` \ No newline at end of file +Default: `Mocks` + +## `Serilog` + +Configure [Serilog logger](https://github.com/serilog/serilog-settings-configuration) +