Skip to main content

Definition

Assembly: CloudNimble.Breakdance.DotHttp.dll Namespace: CloudNimble.Breakdance.DotHttp Inheritance: System.Object

Syntax

CloudNimble.Breakdance.DotHttp.EnvironmentLoader

Summary

Loads and parses http-client.env.json environment files.

Remarks

Supports $shared variables, environment-specific values, provider-based secrets, and .user file overrides.

Examples

var loader = new EnvironmentLoader();
var environment = loader.LoadFromFile("http-client.env.json");
var variables = loader.GetResolvedVariables(environment, "dev");

Constructors

.ctor

Syntax

public EnvironmentLoader()

.ctor Inherited

Inherited from object

Syntax

public Object()

Methods

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetResolvedVariables

Gets the resolved variables for a specific environment, including $shared values.

Syntax

public System.Collections.Generic.Dictionary<string, string> GetResolvedVariables(CloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironment environment, string environmentName)

Parameters

NameTypeDescription
environmentCloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironmentThe environment configuration.
environmentNamestringThe name of the environment (e.g., “dev”, “staging”).

Returns

Type: System.Collections.Generic.Dictionary<string, string> A dictionary of resolved variable names and values.

Examples

var loader = new EnvironmentLoader();
var env = loader.LoadFromFile("http-client.env.json");
var devVars = loader.GetResolvedVariables(env, "dev");
// devVars contains merged $shared and dev-specific variables

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

LoadFromFile

Loads an environment configuration from a JSON file path.

Syntax

public CloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironment LoadFromFile(string filePath)

Parameters

NameTypeDescription
filePathstringThe path to the http-client.env.json file.

Returns

Type: CloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironment A DotHttpEnvironment containing the parsed configuration.

Examples

var loader = new EnvironmentLoader();
var environment = loader.LoadFromFile("http-client.env.json");
foreach (var envName in environment.Environments.Keys)
{
    Console.WriteLine($"Environment: {envName}");
}

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

MergeWithUserOverrides

Merges the user override file (.user) with the base environment.

Syntax

public CloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironment MergeWithUserOverrides(CloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironment baseEnvironment, string userFilePath)

Parameters

NameTypeDescription
baseEnvironmentCloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironmentThe base environment from http-client.env.json.
userFilePathstringThe path to the http-client.env.json.user file.

Returns

Type: CloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironment The merged environment configuration.

Examples

var loader = new EnvironmentLoader();
var baseEnv = loader.LoadFromFile("http-client.env.json");
var mergedEnv = loader.MergeWithUserOverrides(baseEnv, "http-client.env.json.user");

Remarks

User override values take precedence over base environment values.

Parse

Parses environment configuration from JSON content.

Syntax

public CloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironment Parse(string jsonContent)

Parameters

NameTypeDescription
jsonContentstringThe JSON content of the environment file.

Returns

Type: CloudNimble.Breakdance.DotHttp.Models.DotHttpEnvironment A DotHttpEnvironment containing the parsed configuration.

Examples

var loader = new EnvironmentLoader();
var json = @"{
  ""$shared"": { ""ApiVersion"": ""v2"" },
  ""dev"": { ""HostAddress"": ""https://localhost:5001"" }
}";
var environment = loader.Parse(json);

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?