• NeonSDK
  • NeonKUBE
Search Results for

    Show / Hide Table of Contents
    • Neon
      • Build
    • Neon.Blazor
      • BlazorHelper
      • BodyOutlet
      • ClientRenderContext
      • DOMRectReadOnly
      • EventHandlers
      • FileDownloader
      • HtmlElement
      • IRenderContext
      • IntersectionChangedEventArgs
      • IntersectionObserver
      • IntersectionObserverContext
      • MobileDetector
      • NeonBlazorExtensions
      • ServerRenderContext
      • SwipeDirection
      • SwipeHandler
    • Neon.Blazor.Analyzers
      • SvgGenerator
      • SvgGenerator.Svg
    • Neon.BuildInfo
      • ThisAssembly
      • ThisAssembly.Git
      • ThisAssembly.Git.BaseVersion
      • ThisAssembly.Git.SemVer
    • Neon.CSharp
      • CSharpHelper
      • CompilerErrorException
      • MetadataReferences
    • Neon.Cassandra
      • KeyspaceStatus
      • RowSetExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
      • SessionExtensions
    • Neon.Collections
      • ArgDictionary
      • Bits
      • IObjectDictionary
      • NiceDictionary<TKey, TValue>
      • ObjectDictionary
    • Neon.Common
      • AppDomainExtensions
      • Block
      • BlockArray
      • ByteEncoding
      • ByteUnits
      • CommandLine
      • CommandLine.OptionDefinition
      • CommandLine.Redactor
      • CpuArchitecture
      • Credentials
      • DateTimeExtensions
      • EnumExtensions
      • EnvironmentParser
      • EnvironmentParser.Parser<T>
      • EnvironmentParser.Validator<T>
      • EnvironmentParser.VariableSource
      • ExceptionExtensions
      • ExecuteException
      • ExecuteResponse
      • GlobPattern
      • HexDumpOption
      • HttpClientExtensions
      • HttpResponseMessageExtensions
      • IEnumerableExtensions
      • ILabeled
      • IOExtensions
      • IServiceContainer
      • IStaticDirectoryExtensions
      • LabelSelector
      • LabelSelectorOptions
      • LabelSelector<TItem>
      • NeonAssemblyExtensions
      • NeonExtendedHelper
      • NeonHelper
      • NetFramework
      • NewtonsoftExtensions
      • NotReadyException
      • ProcessExtensions
      • ProgramEntrypoint
      • ProgramEntrypointAsync
      • ProgramExitException
      • ProgramRunner
      • RandomExtensions
      • ReflectionExtensions
      • SemanticVersion
      • ServiceContainer
      • StaticZipOptions
      • StringBuilderExtensions
      • StringExtensions
      • Stub
      • Stub.Value
      • TaskExtensions
      • TimeSpanExtensions
      • ToolException
      • TriState
      • WeakEventController
      • WindowsEdition
      • WindowsFeatureStatus
      • YamlDotNetExtensions
    • Neon.Cryptography
      • AesCipher
      • CryptoExtensions
      • CryptoHelper
      • NeonVault
      • Wildcard
    • Neon.Csv
      • CsvReader
      • CsvTableReader
      • CsvTableWriter
      • CsvWriter
    • Neon.Data
      • DateTimeJsonConverter
      • DateTimeOffsetJsonConverter
      • IEnhancedJsonConverter
      • IGeneratedServiceClient
      • IPersistableType
      • IPersistableType<T>
      • IRoundtripData
      • IntegerEnumConverter<TEnum>
      • NotifyPropertyChanged
      • RoundtripDataFactory
      • RoundtripDataHelper
      • TimeSpanJsonConverter
      • VersionJsonConverter
    • Neon.Deployment
      • AwsCli
      • DeploymentException
      • DeploymentHelper
      • DownloadManifest
      • DownloadPart
      • DownloadProgressDelegate
      • DownloadProgressType
      • GitHub
      • GitHubActionsApi
      • GitHubPackage
      • GitHubPackageApi
      • GitHubPackageType
      • GitHubPackageVersion
      • GitHubPackageVisibility
      • GitHubReleaseApi
      • GitHubRepoPath
      • GitHubTagApi
      • IProfileClient
      • IProfileRequest
      • IProfileResponse
      • MaintainerProfile
      • NotifyClient
      • OnePassword
      • OnePasswordException
      • ProfileException
      • ProfileHandlerResult
      • ProfileRequest
      • ProfileResponse
      • ProfileServer
      • ProfileStatus
      • XenServer
    • Neon.Deployment.CodeSigning
      • AzureProfile
      • CodeSigner
      • UsbTokenProfile
    • Neon.Diagnostics
      • AssertException
      • ConfigExtensions
      • ConsoleJsonLogExporter
      • ConsoleJsonLogExporterOptions
      • ConsoleTextLogExporter
      • ConsoleTextLogExporterOptions
      • ExceptionInfo
      • FileLogExporter
      • FileLogExporterFormat
      • FileLogExporterOptions
      • LogAsTraceProcessor
      • LogAsTraceProcessorOptions
      • LogAttributeNames
      • LogAttributes
      • LogEvent
      • LogEventInterceptor
      • LoggerExtensions
      • NullLogger
      • TelemetryHub
      • TelemetrySpanEventNames
      • TelemetrySpanExtensions
    • Neon.Docker
      • DockerClient
      • DockerNetwork
      • DockerNetworkContainer
      • DockerNetworkIpam
      • DockerNode
      • DockerNodeManagerStatus
      • DockerResponse
      • DockerSettings
      • DockerVolume
      • NetworkCreateResponse
      • ServiceBindOptions
      • ServiceConfig
      • ServiceContainerSpec
      • ServiceCredentialSpec
      • ServiceDetails
      • ServiceDiscreteResourceSpec
      • ServiceDnsConfig
      • ServiceEndpoint
      • ServiceEndpointMode
      • ServiceEndpointPortConfig
      • ServiceEndpointSpec
      • ServiceFile
      • ServiceGenericResources
      • ServiceGlobalSchedulingMode
      • ServiceHealthCheck
      • ServiceIsolationMode
      • ServiceListResponse
      • ServiceLogDriver
      • ServiceMode
      • ServiceMount
      • ServiceMountBindPropagation
      • ServiceMountConsistency
      • ServiceMountType
      • ServiceNamedResourceSpec
      • ServiceNetwork
      • ServicePlacement
      • ServicePlacementPreferences
      • ServicePlacementSpreadSettings
      • ServicePlatform
      • ServicePortMode
      • ServicePortProtocol
      • ServicePrivileges
      • ServiceReplicatedSchedulingMode
      • ServiceResourceSettings
      • ServiceResources
      • ServiceRestartCondition
      • ServiceRestartPolicy
      • ServiceRollbackConfig
      • ServiceRollbackFailureAction
      • ServiceRollbackOrder
      • ServiceSELinuxContext
      • ServiceSchedulingMode
      • ServiceSecret
      • ServiceSpec
      • ServiceTaskTemplate
      • ServiceTmpfsOptions
      • ServiceUpdateConfig
      • ServiceUpdateFailureAction
      • ServiceUpdateOrder
      • ServiceUpdateState
      • ServiceUpdateStatus
      • ServiceVersion
      • ServiceVirtualIP
      • ServiceVolumeDriverConfig
      • ServiceVolumeOptions
      • VolumeListResponse
    • Neon.GitHub
      • GitExtensions
      • GitHubCredentials
      • GitHubRepo
      • LocalRepoApi
      • NoLocalRepositoryException
      • RemoteRepoApi
      • RemoteRepoBranchApi
      • RemoteRepoIssueApi
      • RemoteRepoIssueCommentApi
      • RemoteRepoPath
      • RemoteRepoReleaseApi
      • RemoteRepoTagApi
    • Neon.HyperV
      • HyperVClient
      • HyperVDriverType
      • HyperVException
      • NetAdapter
      • VirtualDrive
      • VirtualIPAddress
      • VirtualMachine
      • VirtualMachineNetworkAdapter
      • VirtualMachineState
      • VirtualNat
      • VirtualSwitch
      • VirtualSwitchType
    • Neon.IO
      • BlockStream
      • FixedLengthStream
      • IStaticDirectory
      • IStaticFile
      • LineEnding
      • LinuxPath
      • LinuxPermissions
      • PreprocessReader
      • RelayStream
      • StaticDirectoryBase
      • StaticFileBase
      • SubStream
      • TempFile
      • TempFolder
    • Neon.JsonConverters
      • JsonDateTimeConverter
      • JsonGenericConverter<T>
      • JsonNullableDateTimeConverter
    • Neon.ModelGen
      • ActionResult<T>
      • ApiVersion
      • ApiVersionAttribute
      • BodyStreamAttribute
      • ControllerValidationAttribute
      • DataModelAttribute
      • EnumMember
      • FromBodyAttribute
      • FromHeaderAttribute
      • FromQueryAttribute
      • FromRouteAttribute
      • GeneratedClientAttribute
      • GeneratedMethodAttribute
      • GeneratedParamAttribute
      • HashSourceAttribute
      • HttpAttribute
      • HttpDeleteAttribute
      • HttpGetAttribute
      • HttpHeadAttribute
      • HttpOptionsAttribute
      • HttpPatchAttribute
      • HttpPostAttribute
      • HttpPutAttribute
      • IActionResult
      • ModelGenerator
      • ModelGeneratorOutput
      • ModelGeneratorSettings
      • NoCodeGenAttribute
      • NoControllerValidationAttribute
      • PassAs
      • PersistableAttribute
      • PersistableKeyAttribute
      • RouteAttribute
      • ServiceModelAttribute
      • TargetAttribute
      • UxFrameworks
    • Neon.Net
      • HttpApiException
      • HttpException
      • JsonClient
      • JsonClientPayload
      • JsonResponse
      • Jwt
      • LocalHostSection
      • NetConst
      • NetHelper
      • NetworkCidr
      • NetworkConfiguration
      • NetworkException
      • NetworkPorts
      • Pinger
      • ReachableHost
      • ReachableHostMode
      • StreamDocument
    • Neon.Postgres
      • ConnectionExtensions
      • DatabaseStatus
      • PreparedCommand
      • ReaderAsyncEnumerator
      • ReaderEnumerator
      • ReaderExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
    • Neon.Retry
      • ExponentialRetryPolicy
      • IRetryPolicy
      • LinearRetryPolicy
      • NoRetryPolicy
      • RetryPolicy
      • RetryPolicyBase
      • RetryTransientArgs
      • TransientDetector
      • TransientException
    • Neon.Roslyn
      • DisplayFormat
      • DocumentationComment
      • DocumentationItem
      • MetadataLoadContext
      • RoslynAssembly
      • RoslynConstructorInfo
      • RoslynCustomAttributeData
      • RoslynExtensions
      • RoslynFieldInfo
      • RoslynMethodInfo
      • RoslynParameterInfo
      • RoslynPropertyInfo
      • RoslynType
      • SharedUtilities
    • Neon.Roslyn.Xunit
      • AdditionalSourceText
      • CompilationOptions
      • CompilationOptionsProvider
      • TestCompilation
      • TestCompilationAssertions
      • TestCompilationBuilder
      • TestCompilationBuilderExtensions
      • TestCompilationExtensions
    • Neon.SSH
      • CommandBundle
      • CommandFile
      • CommandResponse
      • HostFolders
      • IBashCommandFormatter
      • ILinuxSshProxy
      • LinuxDiskInfo
      • LinuxDiskPartition
      • LinuxSshProxy
      • LinuxSshProxy<TMetadata>
      • NamespaceDoc
      • RemoteCommandException
      • RunOptions
      • SshCredentials
      • SshExtensions
      • SshProxyException
    • Neon.Service
      • LogMetricsProcessor
      • MetricsMode
      • MetricsOptions
      • NeonService
      • NeonServiceOptions
      • NeonServiceStatus
      • OtelConfigExtensions
      • OtlpCollectorChecker
      • ProcessTerminator
      • ServiceApiContact
      • ServiceApiInfo
      • ServiceApiLicense
      • ServiceDependencies
      • ServiceDescription
      • ServiceEndpoint
      • ServiceEndpointProtocol
      • ServiceEndpoints
      • ServiceMap
    • Neon.SignalR
      • DependencyInjectionExtensions
      • DnsCache
      • GroupAction
      • GroupCommand
      • IDnsCache
      • Invocation
      • NatsHubLifetimeManager<THub>
      • ProxyConfig
      • ServiceCollectionExtensions
      • ServiceDiscovey
      • SignalrProxyMiddleware
      • SignalrProxyMiddlewareExtensions
      • TracerProviderBuilderExtensions
    • Neon.Tailwind
      • ClickOffEventHandler
      • ComponentEventArgs<TSender>
      • ComponentEventArgs<TSender, TEventArgs>
      • DisclosureState
      • EventHandlerComponentBase<TComponent>
      • HeadlessButton
      • HeadlessDialog
      • HeadlessDialogPanel
      • HeadlessDisclosure
      • HeadlessDisclosureButton
      • HeadlessDisclosurePanel
      • HeadlessListboxButton<TValue>
      • HeadlessListboxLabel<TValue>
      • HeadlessListboxOption<TValue>
      • HeadlessListboxOptions<TValue>
      • HeadlessListbox<TValue>
      • HeadlessMenu
      • HeadlessMenuButton
      • HeadlessMenuItem
      • HeadlessMenuItems
      • HeadlessSwitch
      • HeadlessSwitchGroup
      • HeadlessSwitchLabel
      • IPortalBinder
      • KeyDownEventHandler
      • KeyboardKey
      • ListboxFocus
      • ListboxState
      • MenuFocus
      • MenuState
      • Portal
      • PortalBinder
      • PortalContent
      • SearchAssistant
      • TailwindExtensions
      • Transition
      • TransitionGroup
      • TransitionState
    • Neon.Tasks
      • Async
      • AsyncAutoResetEvent
      • AsyncManualResetEvent
      • AsyncMutex
      • AsyncPeriodicTask
      • AsyncReaderWriterLock
      • AsyncReentrantMutex
      • AsyncTimer
      • IAsyncFuture
      • IAsyncFuture<T>
      • NonDisposableTask
      • NonDisposableTask<T>
      • SyncContext
      • SyncContextMode
    • Neon.Temporal
      • ActivityHelper
      • ActivityLogEnricher
      • TemporalEnricherTagNames
      • WorkflowLogEnricher
    • Neon.Time
      • GatedTimer
      • GoDuration
      • PolledTimer
      • RecurringTimer
      • RecurringTimerType
      • SysTime
      • TimeOfDay
    • Neon.WSL
      • Wsl2Proxy
    • Neon.Web
      • AesProtector
      • DataProtectionExtensions
      • NeonController
      • NeonControllerBase
      • RoundTripJsonInputFormatter
      • RoundTripJsonOutputFormatter
      • TracerProviderBuilderExtensions
      • WebHelper
    • Neon.WinTTY
      • ConsoleTTY
    • Neon.Windows
      • MEMORYSTATUSEX
      • PowerShellException
      • Win32
    • Neon.XenServer
      • IXenClient
      • XenClient
      • XenClient.MachineOperations
      • XenClient.StorageOperations
      • XenClient.TemplateOperations
      • XenException
      • XenHostInfo
      • XenObject
      • XenResponse
      • XenStorageRepository
      • XenTempIso
      • XenTemplate
      • XenVirtualDisk
      • XenVirtualMachine
      • XenVmPowerState
    • Neon.Xunit
      • AnsiblePlayResults
      • AnsiblePlayer
      • AnsibleTaskResult
      • AspNetFixture
      • BasicFixture
      • CodeFixture
      • CollectionComparer<T>
      • ComposedFixture
      • ContainerFixture
      • ContainerLimits
      • DockerComposeFixture
      • DockerFixture
      • DockerFixture.ConfigInfo
      • DockerFixture.ContainerInfo
      • DockerFixture.NetworkInfo
      • DockerFixture.SecretInfo
      • DockerFixture.ServiceInfo
      • DockerFixture.StackDefinition
      • DockerFixture.StackInfo
      • DockerFixture.StackService
      • EnvironmentFixture
      • HostsFixture
      • ITestFixture
      • IncompatibleServiceException
      • MaintainerFactAttribute
      • MaintainerTheoryAttribute
      • MockHttpServer
      • MockHttpServerExtensions
      • NatsFixture
      • NatsStreamingFixture
      • NeonServiceFixture<TService>
      • PlatformFactAttribute
      • RepeatAttribute
      • TargetPlatforms
      • TestArea
      • TestCollection
      • TestContext
      • TestFixture
      • TestFixtureStatus
      • TestHelper
      • TestHttpClient
      • TestOutputWriter
      • TestTrait
      • XunitExtensions
    • Neon.Xunit.YugaByte
      • YugaByteFixture
    • Neon.YugaByte
      • YugaByteHelper

    Class EnvironmentParser

    Handles parsing of environment variables by default or optionally variables from a custom source. This has built-in methods for parsing: int, long, double, TimeSpan, string and enum variables as well as mechanisms to parse custom types.

    note

    This class logs details about parsed variables. By default, these logs include actual value that could not be parsed. This may not be desirable for variables defining secrets. Pass redact: true for these cases.

    When debugging, it's useful to ignore redact arguments and include these values in any logged events anyway. You can accomplish this by setting the NEON_REDACT_OVERRIDE=1 environment variable.

    IMPORTANT: Never set NEON_REDACT_OVERRIDE=1 for production.

    Inheritance
    object
    EnvironmentParser
    Namespace: Neon.Common
    Assembly: Neon.Common.dll
    Syntax
    public class EnvironmentParser

    Constructors

    EnvironmentParser(ILogger, VariableSource)

    Constructor.

    Declaration
    public EnvironmentParser(ILogger logger = null, EnvironmentParser.VariableSource source = null)
    Parameters
    Type Name Description
    ILogger logger

    Optionally specifies the logger where parsing errors will be logged.

    EnvironmentParser.VariableSource source

    Optionally specifies an alternative variable source. This defaults to retrieving environment variables.

    Methods

    Get(string, bool, bool, Validator<bool>)

    Attempts to parse an environment variable as a bool, writting messages to the associated logger if one was passed to the constructor.

    Declaration
    public bool Get(string variable, bool defaultInput, bool required = false, EnvironmentParser.Validator<bool> validator = null)
    Parameters
    Type Name Description
    string variable

    The variable name.

    bool defaultInput

    The default value.

    bool required

    Optionally specifies that the variable is required to exist.

    EnvironmentParser.Validator<bool> validator

    Optional validation function to be called to verify that the parsed variable value is valid. This should return null for valid values and an error message for invalid ones.

    Returns
    Type Description
    bool

    The parsed value.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the variable does not exists and required=true.

    FormatException

    Thrown if the variable could not be parsed or the validator returned an error.

    Get(string, double, bool, Validator<double>)

    Attempts to parse an environment variable as an double, writting messages to the associated logger if one was passed to the constructor.

    Declaration
    public double Get(string variable, double defaultInput, bool required = false, EnvironmentParser.Validator<double> validator = null)
    Parameters
    Type Name Description
    string variable

    The variable name.

    double defaultInput

    The default value.

    bool required

    Optionally specifies that the variable is required to exist.

    EnvironmentParser.Validator<double> validator

    Optional validation function to be called to verify that the parsed variable value is valid. This should return null for valid values and an error message for invalid ones.

    Returns
    Type Description
    double

    The parsed value.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the variable does not exists and required=true.

    FormatException

    Thrown if the variable could not be parsed or the validator returned an error.

    Get(string, int, bool, Validator<int>)

    Attempts to parse an environment variable as an int, writting messages to the associated logger if one was passed to the constructor.

    Declaration
    public int Get(string variable, int defaultInput, bool required = false, EnvironmentParser.Validator<int> validator = null)
    Parameters
    Type Name Description
    string variable

    The variable name.

    int defaultInput

    The default value.

    bool required

    Optionally specifies that the variable is required to exist.

    EnvironmentParser.Validator<int> validator

    Optional validation function to be called to verify that the parsed variable value is valid. This should return null for valid values and an error message for invalid ones.

    Returns
    Type Description
    int

    The parsed value.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the variable does not exists and required=true.

    FormatException

    Thrown if the variable could not be parsed or the validator returned an error.

    Get(string, long, bool, Validator<long>)

    Attempts to parse an environment variable as a long, writting messages to the associated logger if one was passed to the constructor.

    Declaration
    public long Get(string variable, long defaultInput, bool required = false, EnvironmentParser.Validator<long> validator = null)
    Parameters
    Type Name Description
    string variable

    The variable name.

    long defaultInput

    The default value.

    bool required

    Optionally specifies that the variable is required to exist.

    EnvironmentParser.Validator<long> validator

    Optional validation function to be called to verify that the parsed variable value is valid. This should return null for valid values and an error message for invalid ones.

    Returns
    Type Description
    long

    The parsed value.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the variable does not exists and required=true.

    FormatException

    Thrown if the variable could not be parsed or the validator returned an error.

    Get(string, string, bool, Validator<string>, bool)

    Attempts to parse an environment variable as a string, writting messages to the associated logger if one was passed to the constructor.

    Declaration
    public string Get(string variable, string defaultInput, bool required = false, EnvironmentParser.Validator<string> validator = null, bool redact = false)
    Parameters
    Type Name Description
    string variable

    The variable name.

    string defaultInput

    The default value.

    bool required

    Optionally specifies that the variable is required to exist.

    EnvironmentParser.Validator<string> validator

    Optional validation function to be called to verify that the parsed variable value is valid. This should return null for valid values and an error message for invalid ones.

    bool redact

    Optionally redact log output of the variable.

    Returns
    Type Description
    string

    The parsed value.

    Remarks
    note

    This class logs details about parsed variables. By default, these logs include actual value that could not be parsed. This may not be desirable for variables defining secrets. Pass redact: true for these cases.

    When debugging, it's useful to ignore redact arguments and include these values in any logged events anyway. You can accomplish this by setting the NEON_REDACT_OVERRIDE=1 environment variable.

    IMPORTANT: Never set NEON_REDACT_OVERRIDE=1 for production.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the variable does not exists and required=true.

    FormatException

    Thrown if the variable could not be parsed or the validator returned an error.

    Get(string, TimeSpan, bool, Validator<TimeSpan>)

    Attempts to parse an environment variable as a TimeSpan, writting messages to the associated logger if one was passed to the constructor.

    Declaration
    public TimeSpan Get(string variable, TimeSpan defaultInput, bool required = false, EnvironmentParser.Validator<TimeSpan> validator = null)
    Parameters
    Type Name Description
    string variable

    The variable name.

    TimeSpan defaultInput

    The default value.

    bool required

    Optionally specifies that the variable is required to exist.

    EnvironmentParser.Validator<TimeSpan> validator

    Optional validation function to be called to verify that the parsed variable value is valid. This should return null for valid values and an error message for invalid ones.

    Returns
    Type Description
    TimeSpan

    The parsed value.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the variable does not exists and required=true.

    FormatException

    Thrown if the variable could not be parsed or the validator returned an error.

    Get<TEnum>(string, TEnum, bool, Validator<TEnum>)

    Attempts to parse an environment variable as an eumeration, writting messages to the associated logger if one was passed to the constructor.

    Declaration
    public TEnum Get<TEnum>(string variable, TEnum defaultInput, bool required = false, EnvironmentParser.Validator<TEnum> validator = null) where TEnum : struct, Enum
    Parameters
    Type Name Description
    string variable

    The variable name.

    TEnum defaultInput

    The default value.

    bool required

    Optionally specifies that the variable is required to exist.

    EnvironmentParser.Validator<TEnum> validator

    Optional validation function to be called to verify that the parsed variable value is valid. This should return null for valid values and an error message for invalid ones.

    Returns
    Type Description
    TEnum

    The parsed value.

    Type Parameters
    Name Description
    TEnum

    The desired enumeration type.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the variable does not exists and required=true.

    FormatException

    Thrown if the variable could not be parsed or the validator returned an error.

    Parse<T>(string, string, Parser<T>, bool, Validator<T>, bool)

    Attempts to parse an environment variable as a T, writting messages to the associated logger if one was passed to the constructor.

    Declaration
    public T Parse<T>(string variable, string defaultInput, EnvironmentParser.Parser<T> parser, bool required = false, EnvironmentParser.Validator<T> validator = null, bool redact = false)
    Parameters
    Type Name Description
    string variable

    The variable name.

    string defaultInput

    The default value.

    EnvironmentParser.Parser<T> parser

    The parser function.

    bool required

    Optionally specifies that the variable is required to exist.

    EnvironmentParser.Validator<T> validator

    Optional validation function.

    bool redact

    Optionally redact log output of the variable.

    Returns
    Type Description
    T

    The parsed value.

    Type Parameters
    Name Description
    T

    The parsed output type.

    Remarks
    note

    This class logs details about parsed variables. By default, these logs include actual value that could not be parsed. This may not be desirable for variables defining secrets. Pass redact: true for these cases.

    When debugging, it's useful to ignore redact arguments and include these values in any logged events anyway. You can accomplish this by setting the NEON_REDACT_OVERRIDE=1 environment variable.

    IMPORTANT: Never set NEON_REDACT_OVERRIDE=1 for production.

    Exceptions
    Type Condition
    KeyNotFoundException

    Thrown if the variable does not exists and required=true.

    FormatException

    Thrown if the variable could not be parsed or the validator returned an error.

    In this article
    Back to top © Copyright 2005-2023 by NEONFORGE LLC