Path: redb-route/tests/redb.Route.Tests/Expressions/EnvNamespaceTests.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests/Expressions/EnvNamespaceTests.cs
----
using AwesomeAssertions;
using redb.Route.Core;
using redb.Route.Expressions;
using redb.Route.Expressions.Ast;
using redb.Route.Predicates;
namespace redb.Route.Tests.Expressions;
///
/// env:NAME (findings register row 34 point 1, closing row 35): the OS environment variable, as Apache Camel's
/// ${env:NAME}; null when it is not set; read on every evaluation; refused under the template sandbox.
/// Until 4.7.0 the engine rendered ${env:NAME} empty, so an HTTP AuthToken = "${env:BILLING_TOKEN}" sent an
/// empty bearer token.
///
public sealed class EnvNamespaceTests : IDisposable
{
private readonly string _name = "REDB_ENV_TEST_" + Guid.NewGuid().ToString("N");
public EnvNamespaceTests() => Environment.SetEnvironmentVariable(_name, "from-env");
public void Dispose() => Environment.SetEnvironmentVariable(_name, null);
private static Exchange Message() => new(new Message("x"));
[Fact]
public void AWholePlaceholder_IsTheValue()
{
new StringExpression("${env:" + _name + "}").Evaluate