Search Results for

    Show / Hide Table of Contents

    Method Load

    | Improve this Doc View Source

    Load()

    Loads one or more .env files. By default, it will search for a file called .env.

    Declaration
    public IEnvironmentVariablesProvider Load()
    Returns
    Type Description
    IEnvironmentVariablesProvider

    An instance representing the provider of environment variables.

    Implements
    IEnvLoader.Load()
    Remarks

    This method starts find the .env file in the current directory and if it does not found it, it starts find in the parent directories of the current directory.

    Exceptions
    Type Condition
    ParserException

    If the parser encounters one or more errors. This exception is not thrown if the IgnoreParserException() method is invoked.

    FileNotFoundException

    If the .env files are not found. This exception is only thrown if the EnableFileNotFoundException() method is invoked.

    | Improve this Doc View Source

    Load(out EnvValidationResult)

    Loads one or more .env files. By default, it will search for a file called .env.

    Declaration
    public IEnvironmentVariablesProvider Load(out EnvValidationResult result)
    Parameters
    Type Name Description
    EnvValidationResult result

    The result contains the errors found by the loader.

    Returns
    Type Description
    IEnvironmentVariablesProvider

    An instance representing the provider of environment variables.

    Implements
    IEnvLoader.Load(out EnvValidationResult)
    Remarks

    This method starts find the .env file in the current directory and if it does not found it, it starts find in the parent directories of the current directory.

    Exceptions
    Type Condition
    ParserException

    If the parser encounters one or more errors. This exception is not thrown if the IgnoreParserException() method is invoked.

    FileNotFoundException

    If the .env files are not found. This exception is only thrown if the EnableFileNotFoundException() method is invoked.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright ©2021 DotEnv.Core