-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdotenv.go
More file actions
31 lines (24 loc) · 794 Bytes
/
dotenv.go
File metadata and controls
31 lines (24 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Package dotenv provides a comprehensive .env file parser with full grammar support.
This package implements the same features as mature dotenv loaders in other languages,
including variable expansion, quoted strings, inline comments, and escape sequences.
The package is organized into several files:
- token.go: Token types and definitions
- tokenizer.go: Lexical analysis and tokenization
- parser.go: Parsing logic and state machine
- env.go: Main API functions for external users
Basic usage:
env, err := dotenv.Load(".env")
if err != nil {
log.Fatal(err)
}
// Apply to current process
err = dotenv.Apply(env)
if err != nil {
log.Fatal(err)
}
For more control, use the Parser directly:
parser := dotenv.NewParser(content)
env, err := parser.Parse()
*/
package dotenv