Search code examples
javascriptnode.jsfirebasedotenv

dotenv API credentials string or unquoted


When using .env files to store API credential, is it better to store them as strings with quotation marks or as unquoted? Are there any differences between the two? For example, I have the following firebase service account credentials in my .env file, which way is better?:

type="service_account"
project_id="asdfghj"
private_key_id="1234567890"

or

type=service_account
project_id=asdfghj
private_key_id=1234567890

Solution

  • Quotes are used commonly when you have a blank space in your value

    some_key="some value"
    

    And/or special characters

    some_key="some-value"
    regex="^\s*-. ^"
    

    If your are using numbers, and you want to get a numeric value, don't use quotes:

    some_key=123456