Skip to content

zztkm/vdotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotenv module for V

Latest version CI

English / Japanese

vdotenv is a module to read environment variables from .env files

module document.

Usage

Add your application configuration to your .env file in the root of your project:

S3_BUCKET=YOURS3BUCKET
DYNAMODB_TABLE=YOURDYNAMODBTABLE

Then in your V app you can do something like

import os

import zztkm.vdotenv

fn main() {
    // loads env vars from a .env file.
    vdotenv.load()

    s3_bucket := os.getenv('S3_BUCKET')
    dynamodb_table := os.getenv('DYNAMODB_TABLE')

    // ...
}

By default, load looks for a file called .env in your current working directory, but you can also specify the file as follows:

vdotenv.load(".env.develop") // load `.env.development`
vdotenv.load(".env", ".env.develop") // load `.env` and `.env.develop`

You can write comments in the env file:

# This is comment
FOO=BAR
API_URL=YOUR_API_URL # This is inline comment

Installation and Import

Using vpm:

Install/Update:

v install zztkm.vdotenv

Import:

import zztkm.vdotenv

Using github (least recommended):

v install --git https://github.com/hungrybluedev/whisker

Import:

import vdotenv

Contributing

Contributing Guide for this repository.

License

MIT License

TDOO

  • cli app
  • README: add tutorial(for dotenv beginner)

Acknowledgement

Author