Again, RCL is just a class library and configuration can be injected into any constructor including a class library. The pattern in the link you provided is used in a service pattern. You have not provided any code that shows your service which makes providing an accurate solution difficult at best.
however, I created an example of fetching configuration in a RCL Razor page using the official RCL and Option pattern documentation.
Create reusable UI using the Razor class library project in ASP.NET Core
Bind hierarchical configuration data using the options pattern
RCL Solution Explorer
Option model
public class RecaptchaSettingsOptions
{
public const string RecaptchaSettings = "RecaptchaSettings";
public string SiteKey { get; set; } = string.Empty;
public string SecretKey { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public string Domain { get; set; } = string.Empty;
}
Page1.cshtml
@page
@model RazorClassLib.MyFeature.Pages.Page1Model
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Page1</title>
</head>
<body>
<div>Hello World</div>
<div>SiteKey = @Model.Options.SiteKey</div>
<div>SecretKey = @Model.Options.SecretKey</div>
<div>Version = @Model.Options.Version</div>
<div>SiteKey = @Model.Options.Domain</div>
</body>
</html>
Page1.cshtml.cs
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using RazorClassLib.Options;
namespace RazorClassLib.MyFeature.Pages;
public class Page1Model : PageModel
{
private readonly IConfiguration _configuration;
public Page1Model(IConfiguration configuration)
{
_configuration = configuration;
}
public void OnGet()
{
Options = new RecaptchaSettingsOptions();
_configuration.GetSection(RecaptchaSettingsOptions.RecaptchaSettings).Bind(Options);
}
public RecaptchaSettingsOptions Options { get; set; }
}
Results of https://localhost:7143/myfeature/page1
Hello World
SiteKey = aaaaa
SecretKey = bbbb
Version = v3
SiteKey = www.recaptcha.net