Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacabraham committed Jan 18, 2024
1 parent a768cf5 commit 4dc327b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# How do I add custom configuration?
There are many ways to supply configuration settings e.g. connection strings to your application, and the [official ASP .NET documentation](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-8.0) explains in great detail the various options you have available.
# How do I add custom application settings?
There are many ways to supply custom application settings e.g. connection strings to your application, and the [official ASP .NET documentation](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-8.0) explains in great detail the various options you have available.

## Configuration of the Server
In this recipe, we show how to add configuration using an `appsettings.json` configuration file.
Expand Down Expand Up @@ -34,7 +34,10 @@ let todosApi (context: HttpContext) =
++ let cfg = context.GetService<IConfiguration>()
++ let value = cfg["MyKey"] // "My appsettings.json Value"
```
> Note that the `todosApi` function will be called on every single ASP .NET request. It is safe to "capture" the `cfg` value and use it across multiple API methods.
> Note that the `todosApi` function will be called on every single ASP .NET request. It is safe to "capture" the `cfg` value and use it across multiple API methods.
### Publishing settings files
Be aware that `appsettings.json` files will be included in your bundle by default. However, depending on your application, it can be overridden by e.g. environment variables.

## Working with User Secrets
User Secrets are an alternative way of storing secrets which, although still stored in plain text files, are not stored in your repository folder and therefore less at risk to accidentally committing into source control. However, Saturn currently disables User Secrets as part of its startup routine, and you must manually turn them back on:
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ nav:
- Test the Client: "recipes/developing-and-testing/testing-the-client.md"
- Test the Server: "recipes/developing-and-testing/testing-the-server.md"
- Debug a SAFE app: "recipes/developing-and-testing/debug-safe-app.md"
- Application Configuration: "recipes/developing-and-testing/app-configuration.md"
- Specify app settings: "recipes/developing-and-testing/specify-app-settings.md"
- UI:
- Add Tailwind support: "recipes/ui/add-tailwind.md"
- Remove Tailwind support: "recipes/ui/remove-tailwind.md"
Expand Down

0 comments on commit 4dc327b

Please sign in to comment.