English / Japanese
vdotenv is a module to read environment variables from .env
files
- Which loads env vars from a .env file.
- Existing environment variables can be overridden in the program
- Inspired by https://github.com/joho/godotenv.
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
Install/Update:
v install zztkm.vdotenv
Import:
import zztkm.vdotenv
v install --git https://github.com/hungrybluedev/whisker
Import:
import vdotenv
Contributing Guide for this repository.
- cli app
- README: add tutorial(for dotenv beginner)