Skip to content

Document how .env files work #544

Description

Activity

  1. brettcannon commented on Jan 12, 2018

    @brettcannon
    MemberAuthor

    Don Jayamanne (@DonJayamanne) Is it just a file named .env? And is it just every line formatted at var=val? Comments allowed somehow or anything else that one needs to know to document this?

  2. DonJayamanne commented on Jan 16, 2018

    @DonJayamanne
    • Comments starting with # are ignored
    • Multi line variables are not supported
    • Basic format is var=val
    • The name of the file defaults to .env,
    • The name of the file is configurable in the (use/workspace) settings as follows:
    "python.envFile": "${workspaceFolder}/environmentFile.txt"
    • The name of the file is configurable in the debugger launch settings as follows:
    "envFile": "${workspaceFolder}/environmentFile.txt",
    • If the setting envFile (listed previously) is not available in the launch.json (debugger settings file), then the environment file will not be loaded (i.e there are no defaults if the setting is missing from the configuration file).
  3. brettcannon commented on Jan 16, 2018

    @brettcannon
    MemberAuthor

    So if python.envFile is required to be set for this to work, what is the default file name of .env from? Is there a command to create it or something?

  4. DonJayamanne commented on Jan 16, 2018

    @DonJayamanne

    So if python.envFile is required to be set for this to work,

    Yes

    what is the default file name of .env from

    This default value comes from the configuration settings in package.json for python.envFile.
    I.e. even if the user doesn't provide this, the default is ${workspaceFolder}/.env

    Is there a command to create it or something?

    No. Currently we expect the user to create a file maually (named .env or other and configure the settings accordingly).

  5. brettcannon commented on Jan 17, 2018

    @brettcannon
    MemberAuthor

    OK, so python.envFile isn't directly required because we provide a default value.

  6. DonJayamanne commented on Jan 17, 2018

    @DonJayamanne

    OK, so python.envFile isn't directly required because we provide a default value.

    Yes

  7. monkeez commented on Feb 26, 2018

    @monkeez

    Can you set values in the .env file that get picked up in the python workspace settings?

    Say I had an .env file with:

    MY_VARIABLE=C:/some/path/
    

    Then in my workspace settings I had:

    {
        "python.pythonPath": "${env:MY_VARIABLE}/python"
    }
    

    Would this work?

  8. DonJayamanne commented on Feb 26, 2018

    @DonJayamanne

    Mitch Coote (@monkeez)
    No this wouldn't.

  9. barakbd commented on Apr 10, 2018

    @barakbd

    I have a multi-line variable (encrypted private key). How can I get around this issue?

  10. DonJayamanne commented on Apr 10, 2018

    @DonJayamanne

    Barak BD (@barakbd) please create a separate issue for this (so it can be tracked). Currently its not supported, but should be easy to fix.

  11. locked as resolved and limited conversation to collaborators on Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions