diff --git a/Browser51Did/Demo.cs b/Browser51Did/Demo.cs
index 311bbe0..e253f14 100644
--- a/Browser51Did/Demo.cs
+++ b/Browser51Did/Demo.cs
@@ -98,10 +98,10 @@ public string JsonEndpointPath(ExampleDescriptor? descriptor)
/// It is the demo at DEMO_URL where that is set, and otherwise the DEMO_LANG
/// demo, dotnet unless another is named, which the suite launches from its
/// sibling checkout through , the way
-/// the Contract tests launch an example. It is started with exactly the two
-/// input variables every language's demo reads, 51DEGREES_RESOURCE_KEY and
-/// 51DEGREES_CLOUD_ENDPOINT, taken from this run's own environment (the key
-/// from _51DEGREES_RESOURCE_KEY_51DID where 51DEGREES_RESOURCE_KEY is
+/// the Contract tests launch an example. It is started with its resource key
+/// and cloud endpoint, set under the names that demo reads (see
+/// ) and taken from this run's own environment
+/// (the key from _51DEGREES_RESOURCE_KEY_51DID where 51DEGREES_RESOURCE_KEY is
/// unset), and with the runtime's own way of choosing a port. DEMO_MODE chooses the
/// route prefix, cloud unless pipeline is named.
///
diff --git a/Browser51Did/Harness.cs b/Browser51Did/Harness.cs
index 4cb1632..5138639 100644
--- a/Browser51Did/Harness.cs
+++ b/Browser51Did/Harness.cs
@@ -57,11 +57,13 @@ private static Setting Read(Func require)
///
/// The cloud, for example https://localhost:5443, with no trailing
- /// slash, taken from 51DEGREES_CLOUD_ENDPOINT, the variable the demo is
- /// started with. That endpoint names the api/v4 path, as every reader of
- /// it expects, and the path is taken off here, because what the tests
- /// ask the cloud directly they build from its root. An endpoint written
- /// without the path is taken as the root.
+ /// slash, taken from 51DEGREES_CLOUD_ENDPOINT. The demo is started with
+ /// the same value under each name it reads, as
+ /// sets out. That endpoint
+ /// names the api/v4 path, as every reader of it expects, and the path
+ /// is taken off here, because what the tests ask the cloud directly
+ /// they build from its root. An endpoint written without the path is
+ /// taken as the root.
///
public static string? CloudUrl
{
@@ -81,10 +83,11 @@ public static string? CloudUrl
///
/// The resource key the demo is started with, from
- /// 51DEGREES_RESOURCE_KEY, the variable every language's demo reads
- /// first, or where that is unset from _51DEGREES_RESOURCE_KEY_51DID,
- /// the name continuous integration sets. The demo is given it as
- /// 51DEGREES_RESOURCE_KEY either way.
+ /// 51DEGREES_RESOURCE_KEY, or where that is unset from
+ /// _51DEGREES_RESOURCE_KEY_51DID, the name continuous integration sets.
+ /// The demo is given it under each name it reads, as
+ /// sets out, whichever of the
+ /// two it was read from.
///
/// The tests that create a 51Did for a standard or personalized answer
/// need a resource key whose products include CloudV5FODiD.
@@ -119,7 +122,7 @@ public static string? CloudUrl
+ "path, and 51DEGREES_RESOURCE_KEY, or where that is unset "
+ "_51DEGREES_RESOURCE_KEY_51DID, a resource key the cloud "
+ "creates 51Dids for standard and personalized answers with. Both "
- + "are handed to the demo under the first names. See "
+ + "are handed to the demo under each name it reads. See "
+ "Browser51Did/README.md.";
///
diff --git a/Browser51Did/README.md b/Browser51Did/README.md
index e432aca..687124d 100644
--- a/Browser51Did/README.md
+++ b/Browser51Did/README.md
@@ -78,9 +78,9 @@ the Contract tests start an example.
| Variable | Meaning |
| --- | --- |
-| `51DEGREES_CLOUD_ENDPOINT` | The cloud, including its `api/v4` path. Handed to the demo unchanged. |
-| `51DEGREES_RESOURCE_KEY` | A resource key the cloud creates 51Dids for standard and personalized answers with. Handed to the demo under this name, and never printed, because every message a test produces has it taken out. |
-| `_51DEGREES_RESOURCE_KEY_51DID` | Read only where `51DEGREES_RESOURCE_KEY` is unset, and handed to the demo as `51DEGREES_RESOURCE_KEY`. This is the name continuous integration sets, for a resource key carrying the 51Did product. |
+| `51DEGREES_CLOUD_ENDPOINT` | The cloud, including its `api/v4` path. Handed to the demo unchanged, under each name it reads. The dotnet demo is given `_51DEGREES_CLOUD_ENDPOINT`, which it reads first, and `51DEGREES_CLOUD_ENDPOINT`, which its older versions read. |
+| `51DEGREES_RESOURCE_KEY` | A resource key the cloud creates 51Dids for standard and personalized answers with. Handed to the demo under each name it reads, `_51DEGREES_RESOURCE_KEY` and `51DEGREES_RESOURCE_KEY` for the dotnet demo, and never printed, because every message a test produces has it taken out. |
+| `_51DEGREES_RESOURCE_KEY_51DID` | Read only where `51DEGREES_RESOURCE_KEY` is unset, and handed to the demo in the same way. This is the name continuous integration sets, for a resource key carrying the 51Did product. |
| `DEMO_LANG` | The demo to launch from the sibling checkout. `dotnet` unless set. |
| `DEMO_URL` | A demo already running, which is used instead of launching one. |
| `DEMO_MODE` | `cloud` unless set to `pipeline`. |
@@ -109,7 +109,7 @@ another name.
## Adding a demo in another language
1. Copy the demo's static files and templates, and fill the same
- placeholders from the same two variables.
+ placeholders from the resource key and the cloud endpoint.
2. Serve every route under `/cloud/`, and under `/pipeline/` once the
language's own web integration serves the client script, answering any
host name, because the tests load the pages as `site-a.localtest` and
diff --git a/Examples/ExampleApps.cs b/Examples/ExampleApps.cs
index e234629..1c8d6da 100644
--- a/Examples/ExampleApps.cs
+++ b/Examples/ExampleApps.cs
@@ -151,11 +151,11 @@ public static bool TryCreateDemo(
///
/// Per-language demos. Each serves the same pages under the same
- /// routes, and reads its input data from the same two variables,
- /// 51DEGREES_RESOURCE_KEY and 51DEGREES_CLOUD_ENDPOINT, so a demo in
- /// another language is added here and nothing else in the suite
- /// changes. The suite always hands the key over under the runtime
- /// name, whichever of its two names the suite read it from.
+ /// routes, and reads its input data from a resource key and a cloud
+ /// endpoint variable, so a demo in another language is added here and
+ /// nothing else in the suite changes. The suite always hands the key
+ /// over under the runtime names, whichever of its two names the suite
+ /// read it from.
///
public static readonly IReadOnlyDictionary Demos =
new Dictionary
@@ -172,9 +172,17 @@ public static bool TryCreateDemo(
StartupTimeoutSeconds: 180,
BuildEnv: o => new Dictionary
{
+ // The demo reads the _51DEGREES_ names first and
+ // then the CI name _51DEGREES_RESOURCE_KEY_51DID,
+ // which a CI run may hold, before the older names.
+ // Setting the _51DEGREES_ names makes the key the
+ // suite hands over the one the demo uses. Older
+ // versions read only the older names, so both are set.
+ ["_51DEGREES_RESOURCE_KEY"] = o.ResourceKey,
["51DEGREES_RESOURCE_KEY"] = o.ResourceKey,
// the endpoint includes the api/v4 path, as every
// other 51DEGREES_CLOUD_ENDPOINT reader expects
+ ["_51DEGREES_CLOUD_ENDPOINT"] = new Uri(o.CloudEndpoint, "api/v4/").ToString(),
["51DEGREES_CLOUD_ENDPOINT"] = new Uri(o.CloudEndpoint, "api/v4/").ToString(),
["ASPNETCORE_URLS"] = $"http://localhost:{o.Port}",
}),
diff --git a/Examples/ExampleAppsTests.cs b/Examples/ExampleAppsTests.cs
index 0e5ce16..b15a650 100644
--- a/Examples/ExampleAppsTests.cs
+++ b/Examples/ExampleAppsTests.cs
@@ -94,5 +94,31 @@ public void Descriptors_Dotnet_SetsTheUnderscoreNames()
"the example reads the endpoint, with its api/v4 path, "
+ "from this name");
}
+
+ [TestMethod]
+ public void Demos_Dotnet_SetsTheUnderscoreNames()
+ {
+ var dotnet = ExampleApps.Demos["dotnet"];
+ var env = dotnet.BuildEnv(new ExampleAppOptions(
+ Port: 5123,
+ CloudEndpoint: new Uri("https://cloud.example.test/"),
+ ResourceKey: "key",
+ ExtraEnv: new Dictionary()));
+ Assert.AreEqual("key", env["_51DEGREES_RESOURCE_KEY"],
+ "the demo reads this name before the CI name "
+ + "_51DEGREES_RESOURCE_KEY_51DID, so the key the suite "
+ + "hands over is the one used");
+ Assert.AreEqual("key", env["51DEGREES_RESOURCE_KEY"],
+ "older versions of the demo read the older name");
+ Assert.AreEqual(
+ "https://cloud.example.test/api/v4/",
+ env["_51DEGREES_CLOUD_ENDPOINT"],
+ "the demo reads the endpoint from this name first");
+ Assert.AreEqual(
+ "https://cloud.example.test/api/v4/",
+ env["51DEGREES_CLOUD_ENDPOINT"],
+ "older versions of the demo read the endpoint from the "
+ + "older name");
+ }
}
}
diff --git a/README.md b/README.md
index 5bdbf4a..2b00d33 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ and no keys are committed.
| `CHROMEWEBDRIVER` / `GECKOWEBDRIVER` / `EDGEWEBDRIVER` | optional | A driver, or the directory holding one. GitHub's Linux runner images set these. |
| `CHROME_BIN` / `FIREFOX_BIN` / `EDGE_BIN` | optional | The browser binary to drive, when it is not on the path. |
| `EXAMPLE_URL` / `EXAMPLE_LANG` | `Contract` | The example app to test (CI / local). |
-| `51DEGREES_CLOUD_ENDPOINT` / `51DEGREES_RESOURCE_KEY` | `Browser51Did` | Handed to the demo under these names, the ones every language's demo reads first. |
+| `51DEGREES_CLOUD_ENDPOINT` / `51DEGREES_RESOURCE_KEY` | `Browser51Did` | The cloud and the resource key. Handed to the demo under each name it reads, which for the dotnet demo are the `_51DEGREES_` names as well as these. |
| `_51DEGREES_RESOURCE_KEY_51DID` | `Browser51Did` | Read where `51DEGREES_RESOURCE_KEY` is unset. The name CI sets, for a resource key carrying the 51Did product. |
| `DEMO_URL` / `DEMO_LANG` / `DEMO_MODE` | `Browser51Did` | The demo to test, and `cloud` or `pipeline` pages. |