Skip to content

Environment

Craig edited this page Nov 2, 2018 · 4 revisions

The Nettle environment provides information about, and means to manipulate, the current environment. The environment is managed by the static NettleEnvironment class. There available methods are listed below.

By default, the environment variables collection contains a list of all variable values found in the System.Environment class using the GetEnvironmentVariables method.

GetEnvironmentVariable

Retrieves the value of a Nettle environment variable. Example:

var path = NettleEnvironment.GetEnvironmentVariable
(
    "SystemRoot"
);

Debug.WriteLine(path);

// Displays C:\Windows

SetEnvironmentVariable

Sets the value of a Nettle environment variable. Example:

NettleEnvironment.SetEnvironmentVariable
(
    "NettleNuGetUrl",
    "https://www.nuget.org/packages/Nettle"
);

Environment Functions

There is a GetEnvironmentVariable function that can be used in templates to retrieve environment variables with Nettle.

Example:

{{@GetEnvironmentVariable("NettleNuGetUrl")}}

Renders:

https://www.nuget.org/packages/Nettle
Clone this wiki locally