Table of Contents

Class NiteSettings

Namespace
Nite.Configuration
Assembly
Nite.dll

Effective settings, merged from (highest first):

  1. NITE_* environment variables (NITE_REGISTRY)
  2. the project's nite.json (registry)
  3. the project's .npmrc
  4. the user's config.json in the config directory
  5. the user's ~/.npmrc (or $NPM_CONFIG_USERCONFIG)
  6. built-in defaults

Credentials only come from .npmrc files, so tokens stay where npm users already keep them.

public sealed class NiteSettings
Inheritance
NiteSettings
Inherited Members

Fields

InitTemplateKey

public const string InitTemplateKey = "init.template"

Field Value

string

RegistryKey

public const string RegistryKey = "registry"

Field Value

string

Properties

Registry

public RegistrySettings Registry { get; }

Property Value

RegistrySettings

Values

Every effective value with where it came from; credentials are marked secret.

public IEnumerable<SettingValue> Values { get; }

Property Value

IEnumerable<SettingValue>

Methods

Get(string)

public string? Get(string key)

Parameters

key string

Returns

string

GetWithOrigin(string)

public SettingValue? GetWithOrigin(string key)

Parameters

key string

Returns

SettingValue

IsKnownKey(string)

Keys nite config set accepts: registry, @scope:registry and init.template.

public static bool IsKnownKey(string key)

Parameters

key string

Returns

bool

Load(string?, NiteDirectories?, Func<string, string?>?)

Loads settings for a project (or just the user's, when projectDirectory is null).

public static NiteSettings Load(string? projectDirectory = null, NiteDirectories? directories = null, Func<string, string?>? environment = null)

Parameters

projectDirectory string
directories NiteDirectories
environment Func<string, string>

Returns

NiteSettings

SetUserValue(string, string, NiteDirectories?)

Sets a key in the user's config.json (creating it if needed).

public static void SetUserValue(string key, string value, NiteDirectories? directories = null)

Parameters

key string
value string
directories NiteDirectories

UnknownKeyMessage(string)

public static string UnknownKeyMessage(string key)

Parameters

key string

Returns

string

UnsetUserValue(string, NiteDirectories?)

public static bool UnsetUserValue(string key, NiteDirectories? directories = null)

Parameters

key string
directories NiteDirectories

Returns

bool

Whether the key was set.