Osy#betaRun it on Osyrin: osyrin.com

Reference / Stdlib

App.Version — which version of your app is running, on which platform release

App.Version · App.PlatformVersion

`App.Version` is the version of your app that is answering ("1.0.8") and `App.PlatformVersion` the platform release serving it ("0.17.3"). Both are strings, never null, the same in a server function and on a page, and "dev" when there is no release or version. `ShowVersion = true` on an `AppChrome` shows them in the shell's brand (`WorkbenchShell`: at the end of its status line).

preview3 examples compiled by CIstdlibappversionrelease

Summary#

Two read-only strings that say what is running — for a footer, an "about" box, a support mail, or the shell's brand:

string AboutLine() => "Version " + App.Version + " · platform " + App.PlatformVersion;

[Route("/about")]
[AllowAnonymous]
component About() {
  render { Text(AboutLine()); }
}

Signature#

string App.Version           // "1.0.8" — the app version answering; "dev" when the session serves no version
string App.PlatformVersion   // "0.17.3" — the platform release serving it; "dev" for an unreleased build

Description#

Which version is it?#

App.Version is the version whose model is answering the request. Deployed, that is the version the environment serves: a production environment still on 1.0.7 while staging runs 1.0.8 reads 1.0.7 in production and 1.0.8 in staging, even though 1.0.8 is newer. On a local platform it is the version your last osy compile minted there — that instance's own number, which is what is running on it.

App.PlatformVersion is the platform release serving the app — 0.17.3. A platform built from source rather than released (a local platform, a trunk build) says dev, never a made-up number.

Server and browser agree#

Both are answered in-process on either side: a server function reads them from the session serving it, a page from the values its boot data carries, which come from the same place. They need no [Server] call, no round trip and no permission: a version is not a secret.

Show it in the shell#

Every shell built on AppChrome draws them when you ask: ShowVersion = true puts the app version after the tagline and the platform release on a small line beneath it — factory · 1.0.8 over platform 0.17.3. Off by default: the people running an app want it, its readers mostly do not. WorkbenchShell, whose brand is a bare mark, puts the same two lines at the far end of its status line instead.

[Layout]
[AllowAnonymous]
component Shell() {
  render {
    SidebarShell(new AppChrome {
      Product = "Lantern", Tagline = "workshop", ShowVersion = true, Home = "/",
      Nav = [ new NavItem { Label = "Home", To = "/", Icon = Icons.Home } ],
    }) { Outlet(); }
  }
}

[Route("/")]
[AllowAnonymous]
component Home() {
  render { Text("Welcome"); }
}

Examples#

[Test]
void A_version_is_always_named() {
  Assert.NotEqual("", App.Version);
  Assert.NotEqual("", App.PlatformVersion);
  Assert.Equal("Version " + App.Version + " · platform " + App.PlatformVersion, AboutLine());
}

See also#

Related

App.BaseUrl — the address your app is known by, for links in mail and background work

`App.BaseUrl` is the scheme and host your app answers at, with no trailing slash — what you put in front of a path to…

Environment — the app's own variables

C#'s `System.Environment`, answering with the APP's values and never the host's: `GetEnvironmentVariable(name)` reads…

The standard library — and where each call runs

The pure standard library, and the one fact about it that changes how your app feels: 271 of its 396 methods run in the…