PiBox.Hosting.WebHost is the core package
that allows dotnet dev's
to use the pibox web host and pibox plugins
.
This package is mandatory, without it you can't use any plugins
To install the nuget package follow these steps:
dotnet add package PiBox.Hosting.Generator # this is required so the web host can discover & load the plugins
dotnet add package PiBox.Hosting.WebHost
or add as package reference to your .csproj
<PackageReference Include="PiBox.Hosting.Generator" Version="" />
<PackageReference Include="PiBox.Hosting.WebHost" Version="" />
Rewrite the Entrypoint Program.cs to have following code:
using PiBox.Hosting.WebHost;
PluginWebHostBuilder.RunDefault(PiBox.Generated.PiBoxPluginTypes.All);
PiBox will try to load config files and values in the following order
appsettings.json
appsettings.yaml
appsettings.yml
appsettings.*.json
appsettings.*.yaml
appsettings.*.yml
appsettings.secrets.yml
appsettings.*.secrets.yml
9ENV variables
NOTE: All settings (does not matter which file extension) will be ordered by node length. And the secret files will be loaded as last (except the environment variables).
Example:
- appsettings.yaml
- appsettings.api.yaml
- appsettings.api.host.yaml
- appsettings.secrets.yaml
- apssettings.api.secrets.yaml
- appsettings.api.host.secrets.yaml
- ENV Variables
File names must always start with appsettings
or they will be ignored!
Nested settings use _
to build their hierarchy as ENV variables
host:
urls: http://+:5300 # optional, default is 8080;separate multiple urls with ","
becomes
HOST_URLS=http://+:5300 # optional, default is 8080;separate multiple urls with ","
Configure your config file with these properties
host:
urls: http://+:5300 # optional, default is 8080;separate multiple urls with ","
maxRequestSize: 8388608 # optional, default is 8 MB
or as ENV variables
HOST_URLS=http://+:5300 # optional, default is 8080;separate multiple urls with ","
HOST_MAXREQUESTSIZE=8388608 # optional, default is 8 MB
Configure your appsettings.logging.yml with these properties
serilog:
minimumLevel: Debug # or Warn or Info
override:
System: Error # or Warning or Information
Microsoft: Error # or Warning or Information
or as ENV variables
SERIOLOG_minimumLevel=Debug
SERIOLOG_OVERRIDE_SYSTEM=Error
SERIOLOG_OVERRIDE_MICROSOFT=Error
Rewrite your entrypoint Program.cs to have following code:
PiBox.Hosting.WebHostPluginWebHostBuilder.RunDefault(PiBox.Generated.PiBoxPluginTypes.All);
Now you can add additional plugins as nuget packages to your project and configure them via config files/settings and/or in your web host plugin
Pibox uses open telemetry for it's metrics capabilities. Further info can be found here
Pibox uses open telemetry for it's tracing capabilities. Further info can be found here
https://opentelemetry.io/docs/instrumentation/net/getting-started/
If there is a tracing host configured, the service will try to send any traces to this host. it will also enrich the log messages with SpanIds and TraceIds.
tracing:
host: http://localhost:3333