Skip to content

Commit c86e392

Browse files
committed
Added details about programmic configuration.
1 parent cb17583 commit c86e392

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,64 @@ All public APIs include comprehensive XML documentation with clear descriptions,
8181
```
8282

8383
## Configure Services In Startup.cs
84+
85+
### Basic Configuration (using appsettings.json)
8486
```csharp
8587
public void ConfigureServices(IServiceCollection services)
8688
{
8789
.....
8890
services.AddOptions<GotenbergSharpClientOptions>()
8991
.Bind(Configuration.GetSection(nameof(GotenbergSharpClient)));
9092
services.AddGotenbergSharpClient();
91-
.....
93+
.....
9294
}
95+
```
9396

97+
### Programmatic Configuration
98+
```csharp
99+
public void ConfigureServices(IServiceCollection services)
100+
{
101+
.....
102+
// Configure with an action
103+
services.AddGotenbergSharpClient(options =>
104+
{
105+
options.ServiceUrl = new Uri("http://localhost:3000");
106+
options.TimeOut = TimeSpan.FromMinutes(5);
107+
options.BasicAuthUsername = "username";
108+
options.BasicAuthPassword = "password";
109+
// Configure retry policy
110+
options.RetryPolicy = new RetryPolicyOptions
111+
{
112+
Enabled = true,
113+
RetryCount = 4,
114+
BackoffPower = 1.5,
115+
LoggingEnabled = true
116+
};
117+
});
118+
.....
119+
}
94120
```
121+
122+
### Hybrid Configuration (appsettings + programmatic override)
123+
```csharp
124+
public void ConfigureServices(IServiceCollection services)
125+
{
126+
.....
127+
services.AddOptions<GotenbergSharpClientOptions>()
128+
.Bind(Configuration.GetSection(nameof(GotenbergSharpClient)));
129+
130+
// Override or add settings programmatically
131+
services.AddGotenbergSharpClient(options =>
132+
{
133+
options.TimeOut = TimeSpan.FromMinutes(10); // Override timeout
134+
options.BasicAuthUsername = Environment.GetEnvironmentVariable("GOTENBERG_USER");
135+
options.BasicAuthPassword = Environment.GetEnvironmentVariable("GOTENBERG_PASS");
136+
});
137+
.....
138+
}
139+
```
140+
141+
95142
# Using GotenbergSharpClient
96143
*See the [examples folder](examples/)* for complete working examples as console applications.
97144

0 commit comments

Comments
 (0)